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


PHP DBfetchArray函数代码示例

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


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

示例1: rightsForLink

function rightsForLink($idl)
{
    $glinks = DBfetchArray(DBselect('SELECT host1, host2
	FROM hosts_links WHERE hosts_links.id = ' . $idl));
    if (API::Host()->isWritable(array(1 * $glinks[0]['host1'])) and API::Host()->isWritable(array(1 * $glinks[0]['host2']))) {
        return true;
    }
    return false;
}
开发者ID:pida42,项目名称:Zabbix-Addons,代码行数:9,代码来源:imap.php

示例2: getLast

 /**
  * Returns the last $limit history objects for the given items.
  *
  * @param array $items      an array of items with the 'itemid' and 'value_type' properties
  * @param int   $limit
  * @param int   $period     the maximum period to retrieve data for
  *
  * @return array    an array with items IDs as keys and arrays of history objects as values
  */
 public function getLast(array $items, $limit = 1, $period = null)
 {
     $rs = array();
     foreach ($items as $item) {
         $values = DBfetchArray(DBselect('SELECT *' . ' FROM ' . self::getTableName($item['value_type']) . ' h' . ' WHERE h.itemid=' . zbx_dbstr($item['itemid']) . ($period ? ' AND h.clock>' . (time() - $period) : '') . ' ORDER BY h.clock DESC', $limit));
         if ($values) {
             $rs[$item['itemid']] = $values;
         }
     }
     return $rs;
 }
开发者ID:itnihao,项目名称:zatree-2.2,代码行数:20,代码来源:CHistoryManager.php

示例3: CComboBox

$generalComboBox = new CComboBox('configDropDown', 'adm.valuemapping.php', 'redirect(this.options[this.selectedIndex].value);');
$generalComboBox->addItems(array('adm.gui.php' => _('GUI'), 'adm.housekeeper.php' => _('Housekeeping'), 'adm.images.php' => _('Images'), 'adm.iconmapping.php' => _('Icon mapping'), 'adm.regexps.php' => _('Regular expressions'), 'adm.macros.php' => _('Macros'), 'adm.valuemapping.php' => _('Value mapping'), 'adm.workingtime.php' => _('Working time'), 'adm.triggerseverities.php' => _('Trigger severities'), 'adm.triggerdisplayoptions.php' => _('Trigger displaying options'), 'adm.other.php' => _('Other')));
$valueMapForm = new CForm();
$valueMapForm->cleanItems();
$valueMapForm->addItem($generalComboBox);
if (!isset($_REQUEST['form'])) {
    $valueMapForm->addItem(new CSubmit('form', _('Create value map')));
}
$valueMapWidget = new CWidget();
$valueMapWidget->addPageHeader(_('CONFIGURATION OF VALUE MAPPING'), $valueMapForm);
if (isset($_REQUEST['form'])) {
    $data = array('form' => get_request('form', 1), 'form_refresh' => get_request('form_refresh', 0), 'valuemapid' => get_request('valuemapid'), 'mappings' => array(), 'mapname' => '', 'confirmMessage' => null, 'add_value' => get_request('add_value'), 'add_newvalue' => get_request('add_newvalue'));
    if (isset($data['valuemapid'])) {
        $data['mapname'] = $dbValueMap['name'];
        if (empty($data['form_refresh'])) {
            $data['mappings'] = DBfetchArray(DBselect('SELECT m.mappingid,m.value,m.newvalue FROM mappings m WHERE m.valuemapid=' . zbx_dbstr($data['valuemapid'])));
        } else {
            $data['mapname'] = get_request('mapname', '');
            $data['mappings'] = get_request('mappings', array());
        }
        $valueMapCount = DBfetch(DBselect('SELECT COUNT(i.itemid) AS cnt FROM items i WHERE i.valuemapid=' . zbx_dbstr($data['valuemapid'])));
        $data['confirmMessage'] = $valueMapCount['cnt'] ? _n('Delete selected value mapping? It is used for %d item!', 'Delete selected value mapping? It is used for %d items!', $valueMapCount['cnt']) : _('Delete selected value mapping?');
    }
    if (empty($data['valuemapid']) && !empty($data['form_refresh'])) {
        $data['mapname'] = get_request('mapname', '');
        $data['mappings'] = get_request('mappings', array());
    }
    order_result($data['mappings'], 'value');
    $valueMapForm = new CView('administration.general.valuemapping.edit', $data);
} else {
    $data = array('valuemaps' => array(), 'displayNodes' => is_array(get_current_nodeid()));
开发者ID:SandipSingh14,项目名称:Zabbix_,代码行数:31,代码来源:adm.valuemapping.php

示例4: resolveGraphNameByIds

 /**
  * Resolve positional macros and functional item macros, for example, {{HOST.HOST1}:key.func(param)}.
  * ! if same graph will be passed more than once only name for first entry will be resolved.
  *
  * @static
  *
  * @param array  $data					list or hashmap of graphs
  * @param int    $data[n]['graphid']	id of graph
  * @param string $data[n]['name']		name of graph
  *
  * @return array	inputted data with resolved names
  */
 public static function resolveGraphNameByIds(array $data)
 {
     self::init();
     $graphIds = array();
     $graphMap = array();
     foreach ($data as $graph) {
         // skip graphs without macros
         if (strpos($graph['name'], '{') !== false) {
             $graphMap[$graph['graphid']] = array('graphid' => $graph['graphid'], 'name' => $graph['name'], 'items' => array());
             $graphIds[$graph['graphid']] = $graph['graphid'];
         }
     }
     $items = DBfetchArray(DBselect('SELECT i.hostid,gi.graphid,h.host' . ' FROM graphs_items gi,items i,hosts h' . ' WHERE gi.itemid=i.itemid' . ' AND i.hostid=h.hostid' . ' AND ' . dbConditionInt('gi.graphid', $graphIds) . ' ORDER BY gi.sortorder'));
     foreach ($items as $item) {
         $graphMap[$item['graphid']]['items'][] = array('hostid' => $item['hostid'], 'host' => $item['host']);
     }
     $graphMap = self::$macrosResolver->resolve(array('config' => 'graphName', 'data' => $graphMap));
     $resolvedGraph = reset($graphMap);
     foreach ($data as &$graph) {
         if ($graph['graphid'] === $resolvedGraph['graphid']) {
             $graph['name'] = $resolvedGraph['name'];
             $resolvedGraph = next($graphMap);
         }
     }
     unset($graph);
     return $data;
 }
开发者ID:omidmt,项目名称:zabbix-greenplum,代码行数:39,代码来源:CMacrosResolverHelper.php

示例5: _

        $messageFailed = _('Cannot change authentication method to HTTP');
        DBstart();
        $result = update_config($config);
        if ($result) {
            // reset all sessions
            if ($isAuthenticationTypeChanged) {
                $result &= DBexecute('UPDATE sessions SET status=' . ZBX_SESSION_PASSIVE . ' WHERE sessionid<>' . zbx_dbstr(CWebUser::$data['sessionid']));
            }
            $isAuthenticationTypeChanged = false;
            add_audit(AUDIT_ACTION_UPDATE, AUDIT_RESOURCE_ZABBIX_CONFIG, $messageSuccess);
        }
        $result = DBend($result);
        show_messages($result, $messageSuccess, $messageFailed);
    }
}
show_messages();
/*
 * Display
 */
$data = array('form_refresh' => getRequest('form_refresh'), 'config' => $config, 'is_authentication_type_changed' => $isAuthenticationTypeChanged, 'user' => getRequest('user', CWebUser::$data['alias']), 'user_password' => getRequest('user_password', ''), 'user_list' => null, 'change_bind_password' => getRequest('change_bind_password'));
// get tab title
$data['title'] = authentication2str($config['authentication_type']);
// get user list
if (getUserGuiAccess(CWebUser::$data['userid']) == GROUP_GUI_ACCESS_INTERNAL) {
    $data['user_list'] = DBfetchArray(DBselect('SELECT u.alias,u.userid FROM users u ORDER BY u.alias'));
}
// render view
$authenticationView = new CView('administration.authentication.edit', $data);
$authenticationView->render();
$authenticationView->show();
require_once dirname(__FILE__) . '/include/page_footer.php';
开发者ID:omidmt,项目名称:zabbix-greenplum,代码行数:31,代码来源:authentication.php

示例6: array

     $usrgrps = API::UserGroup()->get(array('usrgrpids' => $usrgrpids, 'output' => array('name')));
     order_result($usrgrps, 'name');
     $users = API::User()->get(array('userids' => $userids, 'output' => array('alias', 'name', 'surname')));
     order_result($users, 'alias');
     foreach ($users as &$user) {
         $user['fullname'] = getUserFullname($user);
     }
     unset($user);
     $jsInsert = 'addPopupValues(' . zbx_jsvalue(array('object' => 'usrgrpid', 'values' => $usrgrps)) . ');';
     $jsInsert .= 'addPopupValues(' . zbx_jsvalue(array('object' => 'userid', 'values' => $users)) . ');';
     zbx_add_post_js($jsInsert);
     $newOperationsTable->addRow(array(_('Send to User groups'), new CDiv($usrgrpList, 'objectgroup inlineblock border_dotted ui-corner-all')));
     $newOperationsTable->addRow(array(_('Send to Users'), new CDiv($userList, 'objectgroup inlineblock border_dotted ui-corner-all')));
     $mediaTypeComboBox = new CComboBox('new_operation[opmessage][mediatypeid]', $this->data['new_operation']['opmessage']['mediatypeid']);
     $mediaTypeComboBox->addItem(0, '- ' . _('All') . ' -');
     $dbMediaTypes = DBfetchArray(DBselect('SELECT mt.mediatypeid,mt.description' . ' FROM media_type mt' . whereDbNode('mt.mediatypeid')));
     order_result($dbMediaTypes, 'description');
     foreach ($dbMediaTypes as $dbMediaType) {
         $mediaTypeComboBox->addItem($dbMediaType['mediatypeid'], $dbMediaType['description']);
     }
     $newOperationsTable->addRow(array(_('Send only to'), $mediaTypeComboBox));
     $newOperationsTable->addRow(array(_('Default message'), new CCheckBox('new_operation[opmessage][default_msg]', $this->data['new_operation']['opmessage']['default_msg'], 'javascript: submit();', 1)), 'indent_top');
     if (!$this->data['new_operation']['opmessage']['default_msg']) {
         $newOperationsTable->addRow(array(_('Subject'), new CTextBox('new_operation[opmessage][subject]', $this->data['new_operation']['opmessage']['subject'], ZBX_TEXTBOX_STANDARD_SIZE)));
         $newOperationsTable->addRow(array(_('Message'), new CTextArea('new_operation[opmessage][message]', $this->data['new_operation']['opmessage']['message'])));
     } else {
         $newOperationsTable->addItem(new CVar('new_operation[opmessage][subject]', $this->data['new_operation']['opmessage']['subject']));
         $newOperationsTable->addItem(new CVar('new_operation[opmessage][message]', $this->data['new_operation']['opmessage']['message']));
     }
     break;
 case OPERATION_TYPE_COMMAND:
开发者ID:itnihao,项目名称:Zabbix_,代码行数:31,代码来源:configuration.action.edit.php

示例7: getItemFormData


//.........这里部分代码省略.........
        $data['interfaceid'] = $data['item']['interfaceid'];
        $data['type'] = $data['item']['type'];
        $data['snmp_community'] = $data['item']['snmp_community'];
        $data['snmp_oid'] = $data['item']['snmp_oid'];
        $data['port'] = $data['item']['port'];
        $data['value_type'] = $data['item']['value_type'];
        $data['data_type'] = $data['item']['data_type'];
        $data['trapper_hosts'] = $data['item']['trapper_hosts'];
        $data['units'] = $data['item']['units'];
        $data['valuemapid'] = $data['item']['valuemapid'];
        $data['multiplier'] = $data['item']['multiplier'];
        $data['hostid'] = $data['item']['hostid'];
        $data['params'] = $data['item']['params'];
        $data['snmpv3_contextname'] = $data['item']['snmpv3_contextname'];
        $data['snmpv3_securityname'] = $data['item']['snmpv3_securityname'];
        $data['snmpv3_securitylevel'] = $data['item']['snmpv3_securitylevel'];
        $data['snmpv3_authprotocol'] = $data['item']['snmpv3_authprotocol'];
        $data['snmpv3_authpassphrase'] = $data['item']['snmpv3_authpassphrase'];
        $data['snmpv3_privprotocol'] = $data['item']['snmpv3_privprotocol'];
        $data['snmpv3_privpassphrase'] = $data['item']['snmpv3_privpassphrase'];
        $data['ipmi_sensor'] = $data['item']['ipmi_sensor'];
        $data['authtype'] = $data['item']['authtype'];
        $data['username'] = $data['item']['username'];
        $data['password'] = $data['item']['password'];
        $data['publickey'] = $data['item']['publickey'];
        $data['privatekey'] = $data['item']['privatekey'];
        $data['logtimefmt'] = $data['item']['logtimefmt'];
        $data['new_application'] = getRequest('new_application', '');
        if (!$data['is_discovery_rule']) {
            $data['formula'] = $data['item']['formula'];
        }
        if (!$data['limited'] || !isset($_REQUEST['form_refresh'])) {
            $data['delay'] = $data['item']['delay'];
            if (($data['type'] == ITEM_TYPE_TRAPPER || $data['type'] == ITEM_TYPE_SNMPTRAP) && $data['delay'] == 0) {
                $data['delay'] = ZBX_ITEM_DELAY_DEFAULT;
            }
            $data['history'] = $data['item']['history'];
            $data['status'] = $data['item']['status'];
            $data['delta'] = $data['item']['delta'];
            $data['trends'] = $data['item']['trends'];
            $db_delay_flex = $data['item']['delay_flex'];
            if (isset($db_delay_flex)) {
                $arr_of_dellays = explode(';', $db_delay_flex);
                foreach ($arr_of_dellays as $one_db_delay) {
                    $arr_of_delay = explode('/', $one_db_delay);
                    if (!isset($arr_of_delay[0]) || !isset($arr_of_delay[1])) {
                        continue;
                    }
                    array_push($data['delay_flex'], array('delay' => $arr_of_delay[0], 'period' => $arr_of_delay[1]));
                }
            }
            $data['applications'] = array_unique(zbx_array_merge($data['applications'], get_applications_by_itemid($data['itemid'])));
        }
    }
    // applications
    if (count($data['applications']) == 0) {
        array_push($data['applications'], 0);
    }
    $data['db_applications'] = DBfetchArray(DBselect('SELECT DISTINCT a.applicationid,a.name' . ' FROM applications a' . ' WHERE a.hostid=' . zbx_dbstr($data['hostid'])));
    order_result($data['db_applications'], 'name');
    // interfaces
    $data['interfaces'] = API::HostInterface()->get(array('hostids' => $data['hostid'], 'output' => API_OUTPUT_EXTEND));
    // valuemapid
    if ($data['limited']) {
        if (!empty($data['valuemapid'])) {
            if ($map_data = DBfetch(DBselect('SELECT v.name FROM valuemaps v WHERE v.valuemapid=' . zbx_dbstr($data['valuemapid'])))) {
                $data['valuemaps'] = $map_data['name'];
            }
        }
    } else {
        $data['valuemaps'] = DBfetchArray(DBselect('SELECT v.* FROM valuemaps v'));
        order_result($data['valuemaps'], 'name');
    }
    // possible host inventories
    if (empty($data['parent_discoveryid'])) {
        $data['possibleHostInventories'] = getHostInventories();
        // get already populated fields by other items
        $data['alreadyPopulated'] = API::item()->get(array('output' => array('inventory_link'), 'filter' => array('hostid' => $data['hostid']), 'nopermissions' => true));
        $data['alreadyPopulated'] = zbx_toHash($data['alreadyPopulated'], 'inventory_link');
    }
    // template
    $data['is_template'] = isTemplate($data['hostid']);
    // unset snmpv3 fields
    if ($data['type'] != ITEM_TYPE_SNMPV3) {
        $data['snmpv3_contextname'] = '';
        $data['snmpv3_securityname'] = '';
        $data['snmpv3_securitylevel'] = ITEM_SNMPV3_SECURITYLEVEL_NOAUTHNOPRIV;
        $data['snmpv3_authprotocol'] = ITEM_AUTHPROTOCOL_MD5;
        $data['snmpv3_authpassphrase'] = '';
        $data['snmpv3_privprotocol'] = ITEM_PRIVPROTOCOL_DES;
        $data['snmpv3_privpassphrase'] = '';
    }
    // unset ssh auth fields
    if ($data['type'] != ITEM_TYPE_SSH) {
        $data['authtype'] = ITEM_AUTHTYPE_PASSWORD;
        $data['publickey'] = '';
        $data['privatekey'] = '';
    }
    return $data;
}
开发者ID:omidmt,项目名称:zabbix-greenplum,代码行数:101,代码来源:forms.inc.php

示例8: show_messages

        }
    }
}
show_messages();
/*
 * Display
 */
$data = array('form_refresh' => get_request('form_refresh'), 'config' => $config, 'is_authentication_type_changed' => $isAuthenticationTypeChanged, 'user' => get_request('user', $USER_DETAILS['alias']), 'user_password' => get_request('user_password', ''), 'user_list' => null, 'change_bind_password' => get_request('change_bind_password'));
// get tab title
switch ($config['authentication_type']) {
    case ZBX_AUTH_INTERNAL:
        $data['title'] = _('Zabbix internal authentication');
        break;
    case ZBX_AUTH_LDAP:
        $data['title'] = _('LDAP authentication');
        break;
    case ZBX_AUTH_HTTP:
        $data['title'] = _('HTTP authentication');
        break;
    default:
        $data['title'] = '';
}
// get user list
if (get_user_auth($USER_DETAILS['userid']) == GROUP_GUI_ACCESS_INTERNAL) {
    $data['user_list'] = DBfetchArray(DBselect('SELECT u.alias,u.userid' . ' FROM users u' . ' WHERE ' . DBin_node('u.userid') . ' ORDER BY alias'));
}
// render view
$authenticationView = new CView('administration.authentication.edit', $data);
$authenticationView->render();
$authenticationView->show();
require_once 'include/page_footer.php';
开发者ID:quanta-computing,项目名称:debian-packages,代码行数:31,代码来源:authentication.php

示例9: DBend

    }
    $result = DBend($result);
    show_messages($result, _('Configuration updated'), _('Cannot update configuration'));
}
/*
 * Display
 */
$form = new CForm();
$form->cleanItems();
$cmbConf = new CComboBox('configDropDown', 'adm.other.php', 'redirect(this.options[this.selectedIndex].value);');
$cmbConf->addItems(array('adm.gui.php' => _('GUI'), 'adm.housekeeper.php' => _('Housekeeping'), 'adm.images.php' => _('Images'), 'adm.iconmapping.php' => _('Icon mapping'), 'adm.regexps.php' => _('Regular expressions'), 'adm.macros.php' => _('Macros'), 'adm.valuemapping.php' => _('Value mapping'), 'adm.workingtime.php' => _('Working time'), 'adm.triggerseverities.php' => _('Trigger severities'), 'adm.triggerdisplayoptions.php' => _('Trigger displaying options'), 'adm.other.php' => _('Other')));
$form->addItem($cmbConf);
$cnf_wdgt = new CWidget();
$cnf_wdgt->addPageHeader(_('OTHER CONFIGURATION PARAMETERS'), $form);
$data = array();
if (hasRequest('form_refresh')) {
    $data['config']['discovery_groupid'] = getRequest('discovery_groupid');
    $data['config']['alert_usrgrpid'] = getRequest('alert_usrgrpid');
    $data['config']['refresh_unsupported'] = getRequest('refresh_unsupported');
    $data['config']['snmptrap_logging'] = getRequest('snmptrap_logging');
} else {
    $data['config'] = select_config(false);
}
$data['discovery_groups'] = API::HostGroup()->get(array('output' => array('usrgrpid', 'name'), 'filter' => array('flags' => ZBX_FLAG_DISCOVERY_NORMAL), 'editable' => true));
order_result($data['discovery_groups'], 'name');
$data['alert_usrgrps'] = DBfetchArray(DBselect('SELECT u.usrgrpid,u.name FROM usrgrp u'));
order_result($data['alert_usrgrps'], 'name');
$otherForm = new CView('administration.general.other.edit', $data);
$cnf_wdgt->addItem($otherForm->render());
$cnf_wdgt->show();
require_once dirname(__FILE__) . '/include/page_footer.php';
开发者ID:omidmt,项目名称:zabbix-greenplum,代码行数:31,代码来源:adm.other.php

示例10: get_request

    }
    $data['selected_usrgrp'] = get_request('selusrgrp', 0);
    // sort group rights
    order_result($data['group_rights'], 'name');
    // get users
    if ($data['selected_usrgrp'] > 0) {
        $sqlFrom = ',users_groups g';
        $sqlWhere = ' WHERE ' . dbConditionInt('u.userid', $data['group_users']) . ' OR (u.userid=g.userid AND g.usrgrpid=' . zbx_dbstr($data['selected_usrgrp']) . andDbNode('u.userid') . ')';
    } else {
        $sqlFrom = '';
        $sqlWhere = whereDbNode('u.userid');
    }
    $data['users'] = DBfetchArray(DBselect('SELECT DISTINCT u.userid,u.alias,u.name,u.surname' . ' FROM users u' . $sqlFrom . $sqlWhere));
    order_result($data['users'], 'alias');
    // get user groups
    $data['usergroups'] = DBfetchArray(DBselect('SELECT ug.usrgrpid,ug.name' . ' FROM usrgrp ug' . whereDbNode('usrgrpid')));
    order_result($data['usergroups'], 'name');
    // render view
    $userGroupsView = new CView('administration.usergroups.edit', $data);
    $userGroupsView->render();
    $userGroupsView->show();
} else {
    $data = array('displayNodes' => is_array(get_current_nodeid()));
    $sortfield = getPageSortField('name');
    $data['usergroups'] = API::UserGroup()->get(array('output' => API_OUTPUT_EXTEND, 'selectUsers' => API_OUTPUT_EXTEND, 'sortfield' => $sortfield, 'limit' => $config['search_limit'] + 1));
    // sorting & paging
    order_result($data['usergroups'], $sortfield, getPageSortOrder());
    $data['paging'] = getPagingLine($data['usergroups'], array('usrgrpid'));
    // nodes
    if ($data['displayNodes']) {
        foreach ($data['usergroups'] as &$userGroup) {
开发者ID:itnihao,项目名称:zatree-2.2,代码行数:31,代码来源:usergrps.php

示例11: zbx_objectValues

            $items = API::Item()->get(array('itemids' => zbx_objectValues($data['hosts']['items'], 'itemid'), 'output' => array('itemid', 'type')));
            $usedInterfacesTypes = array();
            foreach ($items as $item) {
                $usedInterfacesTypes[$item['type']] = itemTypeInterface($item['type']);
            }
            $initialItemType = min(array_keys($usedInterfacesTypes));
            $data['type'] = getRequest('type') !== null ? $data['type'] : $initialItemType;
            $data['initial_item_type'] = $initialItemType;
            $data['multiple_interface_types'] = count(array_unique($usedInterfacesTypes)) > 1;
        }
    }
    // item types
    $data['itemTypes'] = item_type2str();
    unset($data['itemTypes'][ITEM_TYPE_HTTPTEST]);
    // valuemap
    $data['valuemaps'] = DBfetchArray(DBselect('SELECT v.valuemapid,v.name FROM valuemaps v'));
    order_result($data['valuemaps'], 'name');
    // render view
    $itemView = new CView('configuration.item.massupdate', $data);
    $itemView->render();
    $itemView->show();
} elseif (hasRequest('action') && getRequest('action') == 'item.masscopyto' && hasRequest('group_itemid')) {
    // render view
    $data = getCopyElementsFormData('group_itemid', _('CONFIGURATION OF ITEMS'));
    $data['action'] = 'item.masscopyto';
    $graphView = new CView('configuration.copy.elements', $data);
    $graphView->render();
    $graphView->show();
} else {
    $sortField = getRequest('sort', CProfile::get('web.' . $page['file'] . '.sort', 'name'));
    $sortOrder = getRequest('sortorder', CProfile::get('web.' . $page['file'] . '.sortorder', ZBX_SORT_UP));
开发者ID:TonywalkerCN,项目名称:Zabbix,代码行数:31,代码来源:items.php

示例12: info

            info(_n('There is "%1$d" group with Internal GUI access.', 'There are "%1$d" groups with Internal GUI access.', $result['cnt_usrgrp']));
        }
        if (update_config($config)) {
            // reset all sessions
            if ($isAuthenticationTypeChanged) {
                DBexecute('UPDATE sessions SET status=' . ZBX_SESSION_PASSIVE . ' WHERE sessionid<>' . zbx_dbstr(CWebUser::$data['sessionid']));
            }
            $isAuthenticationTypeChanged = false;
            add_audit(AUDIT_ACTION_UPDATE, AUDIT_RESOURCE_ZABBIX_CONFIG, _('Authentication method changed to HTTP'));
            show_message(_('Authentication method changed to HTTP'));
        } else {
            show_error_message(_('Cannot change authentication method to HTTP'));
        }
    }
}
show_messages();
/*
 * Display
 */
$data = array('form_refresh' => get_request('form_refresh'), 'config' => $config, 'is_authentication_type_changed' => $isAuthenticationTypeChanged, 'user' => get_request('user', CWebUser::$data['alias']), 'user_password' => get_request('user_password', ''), 'user_list' => null, 'change_bind_password' => get_request('change_bind_password'));
// get tab title
$data['title'] = authentication2str($config['authentication_type']);
// get user list
if (getUserGuiAccess(CWebUser::$data['userid']) == GROUP_GUI_ACCESS_INTERNAL) {
    $data['user_list'] = DBfetchArray(DBselect('SELECT u.alias,u.userid' . ' FROM users u' . whereDbNode('u.userid') . ' ORDER BY u.alias'));
}
// render view
$authenticationView = new CView('administration.authentication.edit', $data);
$authenticationView->render();
$authenticationView->show();
require_once dirname(__FILE__) . '/include/page_footer.php';
开发者ID:itnihao,项目名称:zatree-2.2,代码行数:31,代码来源:authentication.php

示例13: unlink


//.........这里部分代码省略.........
         }
     }
     if (!empty($items[ZBX_FLAG_DISCOVERY_NORMAL])) {
         if ($clear) {
             $result = API::Item()->delete(array_keys($items[ZBX_FLAG_DISCOVERY_NORMAL]), true);
             if (!$result) {
                 self::exception(ZBX_API_ERROR_INTERNAL, _('Cannot unlink and clear items'));
             }
         } else {
             DB::update('items', array('values' => array('templateid' => 0), 'where' => array('itemid' => array_keys($items[ZBX_FLAG_DISCOVERY_NORMAL]))));
             foreach ($items[ZBX_FLAG_DISCOVERY_NORMAL] as $item) {
                 info(_s('Unlinked: Item "%1$s" on "%2$s".', $item['name'], $item['host']));
             }
         }
     }
     if (!empty($items[ZBX_FLAG_DISCOVERY_PROTOTYPE])) {
         if ($clear) {
             $result = API::Itemprototype()->delete(array_keys($items[ZBX_FLAG_DISCOVERY_PROTOTYPE]), true);
             if (!$result) {
                 self::exception(ZBX_API_ERROR_INTERNAL, _('Cannot unlink and clear item prototypes'));
             }
         } else {
             DB::update('items', array('values' => array('templateid' => 0), 'where' => array('itemid' => array_keys($items[ZBX_FLAG_DISCOVERY_PROTOTYPE]))));
             foreach ($items[ZBX_FLAG_DISCOVERY_PROTOTYPE] as $item) {
                 info(_s('Unlinked: Item prototype "%1$s" on "%2$s".', $item['name'], $item['host']));
             }
         }
     }
     /* }}} ITEMS, DISCOVERY RULES */
     // host prototypes
     // we need only to unlink host prototypes. in case of unlink and clear they will be deleted together with LLD rules.
     if (!$clear && isset($items[ZBX_FLAG_DISCOVERY_RULE])) {
         $discoveryRuleIds = array_keys($items[ZBX_FLAG_DISCOVERY_RULE]);
         $hostPrototypes = DBfetchArrayAssoc(DBSelect('SELECT DISTINCT h.hostid,h.host,h3.host AS parent_host' . ' FROM hosts h' . ' INNER JOIN host_discovery hd ON h.hostid=hd.hostid' . ' INNER JOIN hosts h2 ON h.templateid=h2.hostid' . ' INNER JOIN host_discovery hd2 ON h.hostid=hd.hostid' . ' INNER JOIN items i ON hd.parent_itemid=i.itemid' . ' INNER JOIN hosts h3 ON i.hostid=h3.hostid' . ' WHERE ' . dbConditionInt('hd.parent_itemid', $discoveryRuleIds)), 'hostid');
         if ($hostPrototypes) {
             DB::update('hosts', array('values' => array('templateid' => 0), 'where' => array('hostid' => array_keys($hostPrototypes))));
             DB::update('group_prototype', array('values' => array('templateid' => 0), 'where' => array('hostid' => array_keys($hostPrototypes))));
             foreach ($hostPrototypes as $hostPrototype) {
                 info(_s('Unlinked: Host prototype "%1$s" on "%2$s".', $hostPrototype['host'], $hostPrototype['parent_host']));
             }
         }
     }
     /* GRAPHS {{{ */
     $sqlFrom = ' graphs g,hosts h';
     $sqlWhere = ' EXISTS (' . 'SELECT ggi.graphid' . ' FROM graphs_items ggi,items ii' . ' WHERE ggi.graphid=g.templateid' . ' AND ii.itemid=ggi.itemid' . ' AND ' . dbConditionInt('ii.hostid', $templateids) . ')' . ' AND ' . dbConditionInt('g.flags', $flags);
     if (!is_null($targetids)) {
         $sqlFrom = ' graphs g,graphs_items gi,items i,hosts h';
         $sqlWhere .= ' AND ' . dbConditionInt('i.hostid', $targetids) . ' AND gi.itemid=i.itemid' . ' AND g.graphid=gi.graphid' . ' AND h.hostid=i.hostid';
     }
     $sql = 'SELECT DISTINCT g.graphid,g.name,g.flags,h.name as host' . ' FROM ' . $sqlFrom . ' WHERE ' . $sqlWhere;
     $dbGraphs = DBSelect($sql);
     $graphs = array(ZBX_FLAG_DISCOVERY_NORMAL => array(), ZBX_FLAG_DISCOVERY_PROTOTYPE => array());
     while ($graph = DBfetch($dbGraphs)) {
         $graphs[$graph['flags']][$graph['graphid']] = array('name' => $graph['name'], 'graphid' => $graph['graphid'], 'host' => $graph['host']);
     }
     if (!empty($graphs[ZBX_FLAG_DISCOVERY_PROTOTYPE])) {
         if ($clear) {
             $result = API::GraphPrototype()->delete(array_keys($graphs[ZBX_FLAG_DISCOVERY_PROTOTYPE]), true);
             if (!$result) {
                 self::exception(ZBX_API_ERROR_INTERNAL, _('Cannot unlink and clear graph prototypes'));
             }
         } else {
             DB::update('graphs', array('values' => array('templateid' => 0), 'where' => array('graphid' => array_keys($graphs[ZBX_FLAG_DISCOVERY_PROTOTYPE]))));
             foreach ($graphs[ZBX_FLAG_DISCOVERY_PROTOTYPE] as $graph) {
                 info(_s('Unlinked: Graph prototype "%1$s" on "%2$s".', $graph['name'], $graph['host']));
             }
开发者ID:omidmt,项目名称:zabbix-greenplum,代码行数:67,代码来源:CHostGeneral.php

示例14: count

        $data['initial_item_type'] = $initialItemType;
        $data['multiple_interface_types'] = count(array_unique($usedInterfacesTypes)) > 1;
    }
    // application
    if (count($data['applications']) == 0) {
        array_push($data['applications'], 0);
    }
    if (!empty($data['hostid'])) {
        $data['db_applications'] = DBfetchArray(DBselect('SELECT a.applicationid,a.name' . ' FROM applications a' . ' WHERE a.hostid=' . zbx_dbstr($data['hostid'])));
        order_result($data['db_applications'], 'name');
    }
    // item types
    $data['itemTypes'] = item_type2str();
    unset($data['itemTypes'][ITEM_TYPE_HTTPTEST]);
    // valuemap
    $data['valuemaps'] = DBfetchArray(DBselect('SELECT v.valuemapid,v.name' . ' FROM valuemaps v' . whereDbNode('v.valuemapid')));
    order_result($data['valuemaps'], 'name');
    // render view
    $itemView = new CView('configuration.item.massupdate', $data);
    $itemView->render();
    $itemView->show();
} elseif ($_REQUEST['go'] == 'copy_to' && isset($_REQUEST['group_itemid'])) {
    $data = array('group_itemid' => get_request('group_itemid', array()), 'hostid' => get_request('hostid', 0), 'copy_type' => get_request('copy_type', 0), 'copy_groupid' => get_request('copy_groupid', 0), 'copy_targetid' => get_request('copy_targetid', array()));
    if (!is_array($data['group_itemid']) || is_array($data['group_itemid']) && count($data['group_itemid']) < 1) {
        error(_('Incorrect list of items.'));
    } else {
        // group
        $data['groups'] = API::HostGroup()->get(array('output' => API_OUTPUT_EXTEND));
        order_result($data['groups'], 'name');
        // hosts
        if ($data['copy_type'] == 0) {
开发者ID:SandipSingh14,项目名称:Zabbix_,代码行数:31,代码来源:items.php

示例15: deleteGroupPrototypes

 /**
  * Deletes the given group prototype and all discovered groups.
  * Deletes also group prototype children.
  *
  * @param array $groupPrototypeIds
  */
 protected function deleteGroupPrototypes(array $groupPrototypeIds)
 {
     // delete child group prototypes
     $groupPrototypeChildren = DBfetchArray(DBselect('SELECT gp.group_prototypeid FROM group_prototype gp WHERE ' . dbConditionInt('templateid', $groupPrototypeIds)));
     if ($groupPrototypeChildren) {
         $this->deleteGroupPrototypes(zbx_objectValues($groupPrototypeChildren, 'group_prototypeid'));
     }
     // delete discovered groups
     $hostGroups = DBfetchArray(DBselect('SELECT groupid FROM group_discovery WHERE ' . dbConditionInt('parent_group_prototypeid', $groupPrototypeIds)));
     if ($hostGroups) {
         API::HostGroup()->delete(zbx_objectValues($hostGroups, 'groupid'), true);
     }
     // delete group prototypes
     DB::delete('group_prototype', ['group_prototypeid' => $groupPrototypeIds]);
 }
开发者ID:jbfavre,项目名称:debian-zabbix,代码行数:21,代码来源:CHostPrototype.php


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