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


PHP IN函数代码示例

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


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

示例1: array

**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
**/
require_once 'include/config.inc.php';
require_once 'include/hosts.inc.php';
require_once 'include/html.inc.php';
$page["title"] = "S_SEARCH";
$page['file'] = 'search.php';
$page['hist_arg'] = array();
$page['scripts'] = array('pmaster.js', 'menu_scripts.js', 'showhint.js', 'scriptaculous.js?load=effects');
$page['type'] = detect_page_type(PAGE_TYPE_HTML);
include_once 'include/page_header.php';
//		VAR				TYPE	OPTIONAL FLAGS	VALIDATION	EXCEPTION
$fields = array('type' => array(T_ZBX_INT, O_OPT, P_SYS, IN('0,1'), NULL), 'search' => array(T_ZBX_STR, O_OPT, P_SYS, NULL, NULL), 'favobj' => array(T_ZBX_STR, O_OPT, P_ACT, NULL, NULL), 'favid' => array(T_ZBX_STR, O_OPT, P_ACT, NOT_EMPTY, 'isset({favobj})'), 'favcnt' => array(T_ZBX_INT, O_OPT, null, null, NULL), 'action' => array(T_ZBX_STR, O_OPT, P_ACT, IN("'add','remove'"), NULL), 'state' => array(T_ZBX_INT, O_OPT, P_ACT, NOT_EMPTY, 'isset({favobj}) && ("hat"=={favobj})'));
check_fields($fields);
// ACTION /////////////////////////////////////////////////////////////////////////////
if (isset($_REQUEST['favobj'])) {
    $_REQUEST['pmasterid'] = get_request('pmasterid', 'mainpage');
    if ('hat' == $_REQUEST['favobj']) {
        update_profile('web.dashboard.hats.' . $_REQUEST['favid'] . '.state', $_REQUEST['state'], PROFILE_TYPE_INT);
    }
    if ('refresh' == $_REQUEST['favobj']) {
        switch ($_REQUEST['favid']) {
            case 'hat_syssum':
                $syssum = make_system_summary();
                $syssum->show();
                break;
            case 'hat_stszbx':
                $stszbx = make_status_of_zbx();
开发者ID:phedders,项目名称:zabbix,代码行数:31,代码来源:search.php

示例2: dirname

**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
**/
require_once dirname(__FILE__) . '/include/config.inc.php';
require_once dirname(__FILE__) . '/include/triggers.inc.php';
require_once dirname(__FILE__) . '/include/services.inc.php';
$page['title'] = _('IT services');
$page['file'] = 'srv_status.php';
$page['hist_arg'] = array();
define('ZBX_PAGE_DO_REFRESH', 1);
require_once dirname(__FILE__) . '/include/page_header.php';
$periods = array('today' => _('Today'), 'week' => _('This week'), 'month' => _('This month'), 'year' => _('This year'), 24 => _('Last 24 hours'), 24 * 7 => _('Last 7 days'), 24 * 30 => _('Last 30 days'), 24 * DAY_IN_YEAR => _('Last 365 days'));
// VAR	TYPE	OPTIONAL	FLAGS	VALIDATION	EXCEPTION
$fields = array('serviceid' => array(T_ZBX_INT, O_OPT, P_SYS | P_NZERO, DB_ID, null), 'showgraph' => array(T_ZBX_INT, O_OPT, P_SYS, IN('1'), 'isset({serviceid})'), 'period' => array(T_ZBX_STR, O_OPT, P_SYS, IN('"' . implode('","', array_keys($periods)) . '"'), null), 'fullscreen' => array(T_ZBX_INT, O_OPT, P_SYS, IN('0,1'), null));
check_fields($fields);
if (isset($_REQUEST['serviceid']) && isset($_REQUEST['showgraph'])) {
    $service = API::Service()->get(array('output' => array('serviceid'), 'serviceids' => getRequest('serviceid')));
    $service = reset($service);
    if ($service) {
        $table = new CTable(null, 'chart');
        $table->addRow(new CImg('chart5.php?serviceid=' . $service['serviceid'] . url_param('path')));
        $table->show();
    } else {
        access_deny();
    }
} else {
    $period = getRequest('period', 7 * 24);
    $period_end = time();
    switch ($period) {
开发者ID:omidmt,项目名称:zabbix-greenplum,代码行数:31,代码来源:srv_status.php

示例3: dirname

** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
**/
require_once dirname(__FILE__) . '/include/config.inc.php';
require_once dirname(__FILE__) . '/include/hosts.inc.php';
require_once dirname(__FILE__) . '/include/graphs.inc.php';
$page['title'] = _('Custom graphs');
$page['file'] = 'charts.php';
$page['hist_arg'] = array('hostid', 'groupid', 'graphid');
$page['scripts'] = array('class.calendar.js', 'gtlc.js', 'flickerfreescreen.js');
$page['type'] = detect_page_type(PAGE_TYPE_HTML);
define('ZBX_PAGE_DO_JS_REFRESH', 1);
ob_start();
require_once dirname(__FILE__) . '/include/page_header.php';
// VAR	TYPE	OPTIONAL	FLAGS	VALIDATION	EXCEPTION
$fields = array('groupid' => array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, null), 'hostid' => array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, null), 'graphid' => array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, null), 'period' => array(T_ZBX_INT, O_OPT, P_SYS, null, null), 'stime' => array(T_ZBX_STR, O_OPT, P_SYS, null, null), 'fullscreen' => array(T_ZBX_INT, O_OPT, P_SYS, IN('0,1'), null), 'filterState' => array(T_ZBX_INT, O_OPT, P_ACT, null, null), 'favobj' => array(T_ZBX_STR, O_OPT, P_ACT, null, null), 'favid' => array(T_ZBX_INT, O_OPT, P_ACT, null, null), 'favaction' => array(T_ZBX_STR, O_OPT, P_ACT, IN('"add","remove"'), null));
check_fields($fields);
/*
 * Permissions
 */
if (getRequest('groupid') && !API::HostGroup()->isReadable(array($_REQUEST['groupid']))) {
    access_deny();
}
if (getRequest('hostid') && !API::Host()->isReadable(array($_REQUEST['hostid']))) {
    access_deny();
}
if (getRequest('graphid')) {
    $graphs = API::Graph()->get(array('graphids' => array($_REQUEST['graphid']), 'output' => array('graphid')));
    if (!$graphs) {
        access_deny();
    }
开发者ID:omidmt,项目名称:zabbix-greenplum,代码行数:31,代码来源:charts.php

示例4: array

** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
**/
require_once 'include/config.inc.php';
require_once 'include/graphs.inc.php';
$page['file'] = 'chart7.php';
$page['title'] = "S_CHART";
$page['type'] = PAGE_TYPE_IMAGE;
include_once 'include/page_header.php';
//		VAR			TYPE	OPTIONAL FLAGS	VALIDATION	EXCEPTION
$fields = array('period' => array(T_ZBX_INT, O_OPT, P_NZERO, BETWEEN(ZBX_MIN_PERIOD, ZBX_MAX_PERIOD), null), 'from' => array(T_ZBX_INT, O_OPT, P_NZERO, null, null), 'stime' => array(T_ZBX_INT, O_OPT, P_NZERO, null, null), 'border' => array(T_ZBX_INT, O_OPT, P_NZERO, IN('0,1'), null), 'name' => array(T_ZBX_STR, O_OPT, NULL, null, null), 'width' => array(T_ZBX_INT, O_OPT, NULL, BETWEEN(0, 65535), null), 'height' => array(T_ZBX_INT, O_OPT, NULL, BETWEEN(0, 65535), null), 'graphtype' => array(T_ZBX_INT, O_OPT, NULL, IN('2,3'), null), 'graph3d' => array(T_ZBX_INT, O_OPT, P_NZERO, IN('0,1'), null), 'legend' => array(T_ZBX_INT, O_OPT, P_NZERO, IN('0,1'), null), 'items' => array(T_ZBX_STR, O_OPT, NULL, null, null));
check_fields($fields);
$available_hosts = get_accessible_hosts_by_user($USER_DETAILS, PERM_READ_ONLY, PERM_RES_IDS_ARRAY, get_current_nodeid(true));
$items = get_request('items', array());
asort_by_key($items, 'sortorder');
foreach ($items as $gitem) {
    if (!($host = DBfetch(DBselect('SELECT h.* FROM hosts h,items i WHERE h.hostid=i.hostid AND i.itemid=' . $gitem['itemid'])))) {
        fatal_error(S_NO_ITEM_DEFINED);
    }
    if (!isset($available_hosts[$host['hostid']])) {
        access_deny();
    }
}
$effectiveperiod = navigation_bar_calc();
if (count($items) == 1) {
    $_REQUEST['period'] = get_request('period', get_profile('web.item.graph.period', ZBX_PERIOD_DEFAULT, null, $items['itemid']));
开发者ID:phedders,项目名称:zabbix,代码行数:31,代码来源:chart7.php

示例5: dirname

** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
**/
require_once dirname(__FILE__) . '/include/config.inc.php';
require_once dirname(__FILE__) . '/include/maps.inc.php';
$page['title'] = _('Logo');
$page['file'] = 'zbxe-customer-logo.php';
$page['type'] = detect_page_type(PAGE_TYPE_IMAGE);
require_once dirname(__FILE__) . '/include/page_header.php';
// VAR	TYPE	OPTIONAL	FLAGS	VALIDATION		EXCEPTION
$fields = array('sysmapid' => array(T_ZBX_INT, O_MAND, P_SYS, DB_ID, null), 'selements' => array(T_ZBX_STR, O_OPT, P_SYS, DB_ID, null), 'links' => array(T_ZBX_STR, O_OPT, P_SYS, DB_ID, null), 'noselements' => array(T_ZBX_INT, O_OPT, null, IN('0,1'), null), 'nolinks' => array(T_ZBX_INT, O_OPT, null, IN('0,1'), null), 'nocalculations' => array(T_ZBX_INT, O_OPT, null, IN('0,1'), null), 'expand_macros' => array(T_ZBX_INT, O_OPT, null, IN('0,1'), null), 'show_triggers' => array(T_ZBX_INT, O_OPT, P_SYS, IN('0,1,2,3'), null), 'severity_min' => array(T_ZBX_INT, O_OPT, null, IN('0,1,2,3,4,5'), null), 'grid' => array(T_ZBX_INT, O_OPT, null, BETWEEN(0, 500), null), 'base64image' => array(T_ZBX_INT, O_OPT, null, IN('0,1'), null));
check_fields($fields);
$maps = API::Map()->get(array('sysmapids' => $_REQUEST['sysmapid'], 'selectSelements' => API_OUTPUT_EXTEND, 'selectLinks' => API_OUTPUT_EXTEND, 'output' => API_OUTPUT_EXTEND, 'preservekeys' => true));
$map = reset($maps);
if (empty($map)) {
    access_deny();
}
$mapPainter = new CMapPainter($map, array('map' => array('drawAreas' => !isset($_REQUEST['selements']) && !isset($_REQUEST['noselements'])), 'grid' => array('size' => get_request('grid', 0))));
$im = $mapPainter->paint();
$colors['Red'] = imagecolorallocate($im, 255, 0, 0);
$colors['Dark Red'] = imagecolorallocate($im, 150, 0, 0);
$colors['Green'] = imagecolorallocate($im, 0, 255, 0);
$colors['Dark Green'] = imagecolorallocate($im, 0, 150, 0);
$colors['Blue'] = imagecolorallocate($im, 0, 0, 255);
$colors['Dark Blue'] = imagecolorallocate($im, 0, 0, 150);
$colors['Yellow'] = imagecolorallocate($im, 255, 255, 0);
开发者ID:zubayr,项目名称:zabbix-extras,代码行数:31,代码来源:zbxe-customer-logo.php

示例6: array

** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
**/
require_once "include/config.inc.php";
require_once "include/media.inc.php";
require_once "include/forms.inc.php";
$page["title"] = "S_MEDIA_TYPES";
$page["file"] = "media_types.php";
$page['hist_arg'] = array('form', 'mediatypeid');
include_once "include/page_header.php";
$fields = array("mediatypeid" => array(T_ZBX_INT, O_NO, P_SYS, DB_ID, '(isset({form})&&({form}=="update"))'), "type" => array(T_ZBX_INT, O_OPT, NULL, IN(implode(',', array(MEDIA_TYPE_EMAIL, MEDIA_TYPE_EXEC, MEDIA_TYPE_SMS, MEDIA_TYPE_JABBER))), '(isset({save}))'), "description" => array(T_ZBX_STR, O_OPT, NULL, NOT_EMPTY, '(isset({save}))'), "smtp_server" => array(T_ZBX_STR, O_OPT, NULL, NOT_EMPTY, 'isset({type})&&({type}==' . MEDIA_TYPE_EMAIL . ')&&isset({save})'), "smtp_helo" => array(T_ZBX_STR, O_OPT, NULL, NOT_EMPTY, 'isset({type})&&({type}==' . MEDIA_TYPE_EMAIL . ')&&isset({save})'), "smtp_email" => array(T_ZBX_STR, O_OPT, NULL, NOT_EMPTY, 'isset({type})&&({type}==' . MEDIA_TYPE_EMAIL . ')&&isset({save})'), "exec_path" => array(T_ZBX_STR, O_OPT, NULL, NOT_EMPTY, 'isset({type})&&({type}==' . MEDIA_TYPE_EXEC . ')&&isset({save})'), "gsm_modem" => array(T_ZBX_STR, O_OPT, NULL, NOT_EMPTY, 'isset({type})&&({type}==' . MEDIA_TYPE_SMS . ')&&isset({save})'), "username" => array(T_ZBX_STR, O_OPT, NULL, NOT_EMPTY, '(isset({type})&&{type}==' . MEDIA_TYPE_JABBER . ')&&isset({save})'), "password" => array(T_ZBX_STR, O_OPT, NULL, NOT_EMPTY, 'isset({type})&&({type}==' . MEDIA_TYPE_JABBER . ')&&isset({save})'), "save" => array(T_ZBX_STR, O_OPT, P_SYS | P_ACT, NULL, NULL), "delete" => array(T_ZBX_STR, O_OPT, P_SYS | P_ACT, NULL, NULL), "cancel" => array(T_ZBX_STR, O_OPT, P_SYS | P_ACT, NULL, NULL), "form" => array(T_ZBX_STR, O_OPT, P_SYS, NULL, NULL), "form_refresh" => array(T_ZBX_INT, O_OPT, NULL, NULL, NULL));
check_fields($fields);
validate_sort_and_sortorder('mt.description', ZBX_SORT_UP);
/* MEDIATYPE ACTIONS */
$result = 0;
if (isset($_REQUEST["save"])) {
    if (isset($_REQUEST["mediatypeid"])) {
        /* UPDATE */
        /*			$action = AUDIT_ACTION_UPDATE;*/
        $result = update_mediatype($_REQUEST["mediatypeid"], $_REQUEST["type"], $_REQUEST["description"], get_request("smtp_server"), get_request("smtp_helo"), get_request("smtp_email"), get_request("exec_path"), get_request("gsm_modem"), get_request('username'), get_request('password'));
        show_messages($result, S_MEDIA_TYPE_UPDATED, S_MEDIA_TYPE_WAS_NOT_UPDATED);
    } else {
        /* ADD */
        /*			$action = AUDIT_ACTION_ADD;*/
        $result = add_mediatype($_REQUEST["type"], $_REQUEST["description"], get_request("smtp_server"), get_request("smtp_helo"), get_request("smtp_email"), get_request("exec_path"), get_request("gsm_modem"), get_request('username'), get_request('password'));
        show_messages($result, S_ADDED_NEW_MEDIA_TYPE, S_NEW_MEDIA_TYPE_WAS_NOT_ADDED);
开发者ID:rennhak,项目名称:zabbix,代码行数:31,代码来源:media_types.php

示例7: dirname

** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
**/
require_once dirname(__FILE__) . '/include/config.inc.php';
$page['title'] = _('Configuration of authentication');
$page['file'] = 'authentication.php';
$page['hist_arg'] = array('config');
require_once dirname(__FILE__) . '/include/page_header.php';
//	VAR						TYPE	OPTIONAL	FLAGS	VALIDATION	EXCEPTION
$fields = array('config' => array(T_ZBX_INT, O_OPT, null, IN(ZBX_AUTH_INTERNAL . ',' . ZBX_AUTH_LDAP . ',' . ZBX_AUTH_HTTP), null), 'form_refresh' => array(T_ZBX_INT, O_OPT, null, null, null), 'update' => array(T_ZBX_STR, O_OPT, P_SYS | P_ACT, null, null), 'test' => array(T_ZBX_STR, O_OPT, P_SYS | P_ACT, null, null), 'ldap_host' => array(T_ZBX_STR, O_OPT, null, NOT_EMPTY, 'isset({config}) && {config} == ' . ZBX_AUTH_LDAP . ' && (isset({update}) || isset({test}))', _('LDAP host')), 'ldap_port' => array(T_ZBX_INT, O_OPT, null, BETWEEN(0, 65535), 'isset({config}) && {config} == ' . ZBX_AUTH_LDAP . ' && (isset({update}) || isset({test}))', _('Port')), 'ldap_base_dn' => array(T_ZBX_STR, O_OPT, null, NOT_EMPTY, 'isset({config}) && {config} == ' . ZBX_AUTH_LDAP . ' && (isset({update}) || isset({test}))', _('Base DN')), 'ldap_bind_dn' => array(T_ZBX_STR, O_OPT, null, null, 'isset({config}) && {config} == ' . ZBX_AUTH_LDAP . ' && (isset({update}) || isset({test}))'), 'ldap_bind_password' => array(T_ZBX_STR, O_OPT, null, null, null, _('Bind password')), 'ldap_search_attribute' => array(T_ZBX_STR, O_OPT, null, NOT_EMPTY, 'isset({config}) && {config} == ' . ZBX_AUTH_LDAP . ' && (isset({update}) || isset({test}))', _('Search attribute')), 'user' => array(T_ZBX_STR, O_OPT, null, NOT_EMPTY, 'isset({config}) && {config} == ' . ZBX_AUTH_LDAP . ' && (isset({update}) || isset({test}))'), 'user_password' => array(T_ZBX_STR, O_OPT, null, NOT_EMPTY, 'isset({config}) && {config} == ' . ZBX_AUTH_LDAP . ' && (isset({update}) || isset({test}))', _('User password')), 'change_bind_password' => array(T_ZBX_STR, O_OPT, null, null, null));
check_fields($fields);
$config = select_config();
if (hasRequest('config')) {
    $isAuthenticationTypeChanged = $config['authentication_type'] != getRequest('config');
    $config['authentication_type'] = getRequest('config');
} else {
    $isAuthenticationTypeChanged = false;
}
foreach ($config as $name => $value) {
    if (array_key_exists($name, $_REQUEST)) {
        $config[$name] = $_REQUEST[$name];
    }
}
/*
 * Actions
开发者ID:omidmt,项目名称:zabbix-greenplum,代码行数:31,代码来源:authentication.php

示例8: dirname

** (at your option) any later version.
**
** This program is distributed in the hope that it will be useful,
** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
**/
require_once dirname(__FILE__) . '/include/config.inc.php';
$page['title'] = _('Configuration of trigger displaying options');
$page['file'] = 'adm.triggerdisplayoptions.php';
require_once dirname(__FILE__) . '/include/page_header.php';
$fields = ['problem_unack_color' => [T_ZBX_CLR, O_OPT, null, null, 'isset({update})', _('Unacknowledged PROBLEM events')], 'problem_ack_color' => [T_ZBX_CLR, O_OPT, null, null, 'isset({update})', _('Acknowledged PROBLEM events')], 'ok_unack_color' => [T_ZBX_CLR, O_OPT, null, null, 'isset({update})', _('Unacknowledged OK events')], 'ok_ack_color' => [T_ZBX_CLR, O_OPT, null, null, 'isset({update})', _('Acknowledged OK events')], 'problem_unack_style' => [T_ZBX_INT, O_OPT, null, IN('1'), null, _('Blinking')], 'problem_ack_style' => [T_ZBX_INT, O_OPT, null, IN('1'), null, _('Blinking')], 'ok_unack_style' => [T_ZBX_INT, O_OPT, null, IN('1'), null, _('Blinking')], 'ok_ack_style' => [T_ZBX_INT, O_OPT, null, IN('1'), null, _('Blinking')], 'ok_period' => [T_ZBX_INT, O_OPT, null, BETWEEN(0, 999999), 'isset({update})', _('Display OK triggers for')], 'blink_period' => [T_ZBX_INT, O_OPT, null, BETWEEN(0, 999999), 'isset({update})', _('On status change triggers blink for')], 'update' => [T_ZBX_STR, O_OPT, P_SYS | P_ACT, null, null], 'form_refresh' => [T_ZBX_INT, O_OPT, null, null, null]];
check_fields($fields);
/*
 * Actions
 */
if (hasRequest('update')) {
    DBstart();
    $result = update_config(['problem_unack_color' => getRequest('problem_unack_color'), 'problem_ack_color' => getRequest('problem_ack_color'), 'ok_unack_color' => getRequest('ok_unack_color'), 'ok_ack_color' => getRequest('ok_ack_color'), 'problem_unack_style' => getRequest('problem_unack_style', 0), 'problem_ack_style' => getRequest('problem_ack_style', 0), 'ok_unack_style' => getRequest('ok_unack_style', 0), 'ok_ack_style' => getRequest('ok_ack_style', 0), 'ok_period' => getRequest('ok_period'), 'blink_period' => getRequest('blink_period')]);
    $result = DBend($result);
    show_messages($result, _('Configuration updated'), _('Cannot update configuration'));
}
/*
 * Display
 */
$config = select_config();
// form has been submitted
开发者ID:jbfavre,项目名称:debian-zabbix,代码行数:31,代码来源:adm.triggerdisplayoptions.php

示例9: dirname

**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
**/
require_once dirname(__FILE__) . '/include/config.inc.php';
require_once dirname(__FILE__) . '/include/hosts.inc.php';
require_once dirname(__FILE__) . '/include/items.inc.php';
require_once dirname(__FILE__) . '/include/forms.inc.php';
$page['title'] = _('Configuration of item prototypes');
$page['file'] = 'disc_prototypes.php';
$page['scripts'] = ['effects.js', 'class.cviewswitcher.js', 'items.js'];
require_once dirname(__FILE__) . '/include/page_header.php';
$paramsFieldName = getParamFieldNameByType(getRequest('type', 0));
// VAR	TYPE	OPTIONAL	FLAGS	VALIDATION	EXCEPTION
$fields = ['parent_discoveryid' => [T_ZBX_INT, O_MAND, P_SYS, DB_ID, null], 'itemid' => [T_ZBX_INT, O_OPT, P_SYS, DB_ID, '(isset({form}) && ({form} == "update"))'], 'interfaceid' => [T_ZBX_INT, O_OPT, P_SYS, DB_ID, null, _('Interface')], 'name' => [T_ZBX_STR, O_OPT, null, NOT_EMPTY, 'isset({add}) || isset({update})', _('Name')], 'description' => [T_ZBX_STR, O_OPT, null, null, 'isset({add}) || isset({update})'], 'key' => [T_ZBX_STR, O_OPT, null, NOT_EMPTY, 'isset({add}) || isset({update})', _('Key')], 'delay' => [T_ZBX_INT, O_OPT, null, BETWEEN(0, SEC_PER_DAY), '(isset({add}) || isset({update}))' . ' && (isset({type}) && ({type} != ' . ITEM_TYPE_TRAPPER . ' && {type} != ' . ITEM_TYPE_SNMPTRAP . '))', _('Update interval (in sec)')], 'delay_flex' => [T_ZBX_STR, O_OPT, null, null, null], 'status' => [T_ZBX_INT, O_OPT, null, IN(ITEM_STATUS_ACTIVE), null], 'type' => [T_ZBX_INT, O_OPT, null, IN([-1, ITEM_TYPE_ZABBIX, ITEM_TYPE_SNMPV1, ITEM_TYPE_TRAPPER, ITEM_TYPE_SIMPLE, ITEM_TYPE_SNMPV2C, ITEM_TYPE_INTERNAL, ITEM_TYPE_SNMPV3, ITEM_TYPE_ZABBIX_ACTIVE, ITEM_TYPE_AGGREGATE, ITEM_TYPE_EXTERNAL, ITEM_TYPE_DB_MONITOR, ITEM_TYPE_IPMI, ITEM_TYPE_SSH, ITEM_TYPE_TELNET, ITEM_TYPE_JMX, ITEM_TYPE_CALCULATED, ITEM_TYPE_SNMPTRAP]), 'isset({add}) || isset({update})'], 'value_type' => [T_ZBX_INT, O_OPT, null, IN('0,1,2,3,4'), 'isset({add}) || isset({update})'], 'data_type' => [T_ZBX_INT, O_OPT, null, IN(ITEM_DATA_TYPE_DECIMAL . ',' . ITEM_DATA_TYPE_OCTAL . ',' . ITEM_DATA_TYPE_HEXADECIMAL . ',' . ITEM_DATA_TYPE_BOOLEAN), '(isset({add}) || isset({update})) && (isset({value_type}) && ({value_type} == ' . ITEM_VALUE_TYPE_UINT64 . '))'], 'valuemapid' => [T_ZBX_INT, O_OPT, null, DB_ID, '(isset({add}) || isset({update})) && isset({value_type})' . ' && ' . IN(ITEM_VALUE_TYPE_FLOAT . ',' . ITEM_VALUE_TYPE_UINT64, 'value_type')], 'authtype' => [T_ZBX_INT, O_OPT, null, IN(ITEM_AUTHTYPE_PASSWORD . ',' . ITEM_AUTHTYPE_PUBLICKEY), '(isset({add}) || isset({update})) && isset({type}) && ({type} == ' . ITEM_TYPE_SSH . ')'], 'username' => [T_ZBX_STR, O_OPT, null, NOT_EMPTY, '(isset({add}) || isset({update})) && isset({type}) && ' . IN(ITEM_TYPE_SSH . ',' . ITEM_TYPE_TELNET, 'type'), _('User name')], 'password' => [T_ZBX_STR, O_OPT, null, null, '(isset({add}) || isset({update})) && isset({type}) && ' . IN(ITEM_TYPE_SSH . ',' . ITEM_TYPE_TELNET, 'type')], 'publickey' => [T_ZBX_STR, O_OPT, null, null, '(isset({add}) || isset({update})) && isset({type})' . ' && ({type}) == ' . ITEM_TYPE_SSH . ' && ({authtype}) == ' . ITEM_AUTHTYPE_PUBLICKEY], 'privatekey' => [T_ZBX_STR, O_OPT, null, null, '(isset({add}) || isset({update})) && isset({type})' . ' && ({type}) == ' . ITEM_TYPE_SSH . ' && ({authtype}) == ' . ITEM_AUTHTYPE_PUBLICKEY], $paramsFieldName => [T_ZBX_STR, O_OPT, null, NOT_EMPTY, '(isset({add}) || isset({update})) && isset({type})' . ' && ' . IN(ITEM_TYPE_SSH . ',' . ITEM_TYPE_DB_MONITOR . ',' . ITEM_TYPE_TELNET . ',' . ITEM_TYPE_CALCULATED, 'type'), getParamFieldLabelByType(getRequest('type', 0))], 'snmp_community' => [T_ZBX_STR, O_OPT, null, NOT_EMPTY, '(isset({add}) || isset({update})) && isset({type}) && ' . IN(ITEM_TYPE_SNMPV1 . ',' . ITEM_TYPE_SNMPV2C, 'type'), _('SNMP community')], 'snmp_oid' => [T_ZBX_STR, O_OPT, null, NOT_EMPTY, '(isset({add}) || isset({update})) && isset({type})' . ' && ' . IN(ITEM_TYPE_SNMPV1 . ',' . ITEM_TYPE_SNMPV2C . ',' . ITEM_TYPE_SNMPV3, 'type'), _('SNMP OID')], 'port' => [T_ZBX_STR, O_OPT, null, BETWEEN(0, 65535), '(isset({add}) || isset({update})) && isset({type})' . ' && ' . IN(ITEM_TYPE_SNMPV1 . ',' . ITEM_TYPE_SNMPV2C . ',' . ITEM_TYPE_SNMPV3, 'type'), _('Port')], 'snmpv3_securitylevel' => [T_ZBX_INT, O_OPT, null, IN('0,1,2'), '(isset({add}) || isset({update})) && (isset({type}) && ({type} == ' . ITEM_TYPE_SNMPV3 . '))'], 'snmpv3_contextname' => [T_ZBX_STR, O_OPT, null, null, '(isset({add}) || isset({update})) && (isset({type}) && ({type} == ' . ITEM_TYPE_SNMPV3 . '))'], 'snmpv3_securityname' => [T_ZBX_STR, O_OPT, null, null, '(isset({add}) || isset({update})) && (isset({type}) && ({type} == ' . ITEM_TYPE_SNMPV3 . '))'], 'snmpv3_authprotocol' => [T_ZBX_INT, O_OPT, null, IN(ITEM_AUTHPROTOCOL_MD5 . ',' . ITEM_AUTHPROTOCOL_SHA), '(isset({add}) || isset({update})) && (isset({type})' . ' && ({type} == ' . ITEM_TYPE_SNMPV3 . ') && ({snmpv3_securitylevel} == ' . ITEM_SNMPV3_SECURITYLEVEL_AUTHPRIV . ' || {snmpv3_securitylevel} == ' . ITEM_SNMPV3_SECURITYLEVEL_AUTHNOPRIV . '))'], 'snmpv3_authpassphrase' => [T_ZBX_STR, O_OPT, null, null, '(isset({add}) || isset({update})) && (isset({type})' . ' && ({type} == ' . ITEM_TYPE_SNMPV3 . ') && ({snmpv3_securitylevel} == ' . ITEM_SNMPV3_SECURITYLEVEL_AUTHPRIV . ' || {snmpv3_securitylevel} == ' . ITEM_SNMPV3_SECURITYLEVEL_AUTHNOPRIV . '))'], 'snmpv3_privprotocol' => [T_ZBX_INT, O_OPT, null, IN(ITEM_PRIVPROTOCOL_DES . ',' . ITEM_PRIVPROTOCOL_AES), '(isset({add}) || isset({update})) && (isset({type}) && ({type} == ' . ITEM_TYPE_SNMPV3 . ')' . ' && ({snmpv3_securitylevel} == ' . ITEM_SNMPV3_SECURITYLEVEL_AUTHPRIV . '))'], 'snmpv3_privpassphrase' => [T_ZBX_STR, O_OPT, null, null, '(isset({add}) || isset({update})) && (isset({type}) && ({type} == ' . ITEM_TYPE_SNMPV3 . ')' . ' && ({snmpv3_securitylevel} == ' . ITEM_SNMPV3_SECURITYLEVEL_AUTHPRIV . '))'], 'ipmi_sensor' => [T_ZBX_STR, O_OPT, P_NO_TRIM, NOT_EMPTY, '(isset({add}) || isset({update})) && (isset({type}) && ({type} == ' . ITEM_TYPE_IPMI . '))', _('IPMI sensor')], 'trapper_hosts' => [T_ZBX_STR, O_OPT, null, null, '(isset({add}) || isset({update})) && isset({type}) && ({type} == 2)'], 'units' => [T_ZBX_STR, O_OPT, null, null, '(isset({add}) || isset({update})) && isset({value_type})' . ' && ' . IN('0,3', 'value_type') . ' (isset({data_type}) && ({data_type} != ' . ITEM_DATA_TYPE_BOOLEAN . '))'], 'multiplier' => [T_ZBX_INT, O_OPT, null, null, null], 'delta' => [T_ZBX_INT, O_OPT, null, IN('0,1,2'), '(isset({add}) || isset({update})) && isset({value_type})' . ' && ' . IN('0,3', 'value_type') . ' (isset({data_type}) && ({data_type} != ' . ITEM_DATA_TYPE_BOOLEAN . '))'], 'formula' => [T_ZBX_DBL_STR, O_OPT, null, '({value_type} == 0 && {} != 0) || ({value_type} == 3 && {} > 0)', '(isset({add}) || isset({update})) && isset({multiplier}) && {multiplier} == 1', _('Custom multiplier')], 'logtimefmt' => [T_ZBX_STR, O_OPT, null, null, '(isset({add}) || isset({update})) && (isset({value_type}) && ({value_type} == 2))'], 'group_itemid' => [T_ZBX_INT, O_OPT, null, DB_ID, null], 'new_application' => [T_ZBX_STR, O_OPT, null, null, 'isset({add}) || isset({update})'], 'applications' => [T_ZBX_INT, O_OPT, null, DB_ID, null], 'new_application_prototype' => [T_ZBX_STR, O_OPT, null, null, 'isset({parent_discoveryid}) && (isset({add}) || isset({update}))'], 'application_prototypes' => [T_ZBX_STR, O_OPT, null, null, null], 'history' => [T_ZBX_INT, O_OPT, null, BETWEEN(0, 65535), 'isset({add}) || isset({update})', _('History storage period')], 'trends' => [T_ZBX_INT, O_OPT, null, BETWEEN(0, 65535), '(isset({add}) || isset({update})) && isset({value_type})' . ' && ' . IN(ITEM_VALUE_TYPE_FLOAT . ',' . ITEM_VALUE_TYPE_UINT64, 'value_type'), _('Trend storage period')], 'action' => [T_ZBX_STR, O_OPT, P_SYS | P_ACT, IN('"itemprototype.massdelete","itemprototype.massdisable","itemprototype.massenable"'), null], 'add' => [T_ZBX_STR, O_OPT, P_SYS | P_ACT, null, null], 'update' => [T_ZBX_STR, O_OPT, P_SYS | P_ACT, null, null], 'clone' => [T_ZBX_STR, O_OPT, P_SYS | P_ACT, null, null], 'delete' => [T_ZBX_STR, O_OPT, P_SYS | P_ACT, null, null], 'cancel' => [T_ZBX_STR, O_OPT, P_SYS, null, null], 'form' => [T_ZBX_STR, O_OPT, P_SYS, null, null], 'form_refresh' => [T_ZBX_INT, O_OPT, null, null, null], 'filter_set' => [T_ZBX_STR, O_OPT, P_SYS, null, null], 'sort' => [T_ZBX_STR, O_OPT, P_SYS, IN('"delay","history","key_","name","status","trends","type"'), null], 'sortorder' => [T_ZBX_STR, O_OPT, P_SYS, IN('"' . ZBX_SORT_DOWN . '","' . ZBX_SORT_UP . '"'), null]];
check_fields($fields);
$_REQUEST['params'] = getRequest($paramsFieldName, '');
unset($_REQUEST[$paramsFieldName]);
// permissions
$discoveryRule = API::DiscoveryRule()->get(['output' => ['hostid'], 'itemids' => getRequest('parent_discoveryid'), 'editable' => true]);
$discoveryRule = reset($discoveryRule);
if (!$discoveryRule) {
    access_deny();
}
$itemPrototypeId = getRequest('itemid');
if ($itemPrototypeId && !API::ItemPrototype()->isWritable([$itemPrototypeId])) {
    access_deny();
}
/*
 * Actions
开发者ID:jbfavre,项目名称:debian-zabbix,代码行数:31,代码来源:disc_prototypes.php

示例10: dirname

** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
**/
require_once dirname(__FILE__) . '/include/config.inc.php';
require_once dirname(__FILE__) . '/include/forms.inc.php';
require_once dirname(__FILE__) . '/include/regexp.inc.php';
$page['title'] = _('Configuration of regular expressions');
$page['file'] = 'adm.regexps.php';
$page['type'] = detect_page_type();
require_once dirname(__FILE__) . '/include/page_header.php';
// VAR	TYPE	OPTIONAL	FLAGS	VALIDATION	EXCEPTION
$fields = ['regexpids' => [T_ZBX_INT, O_OPT, P_SYS, DB_ID, null], 'regexpid' => [T_ZBX_INT, O_OPT, P_SYS, DB_ID, 'isset({form}) && {form} == "update"'], 'name' => [T_ZBX_STR, O_OPT, null, NOT_EMPTY, 'isset({add}) || isset({update})', _('Name')], 'test_string' => [T_ZBX_STR, O_OPT, P_NO_TRIM, null, 'isset({add}) || isset({update})', _('Test string')], 'expressions' => [T_ZBX_STR, O_OPT, P_NO_TRIM, null, 'isset({add}) || isset({update})'], 'action' => [T_ZBX_STR, O_OPT, P_SYS | P_ACT, IN('"regexp.massdelete"'), null], 'add' => [T_ZBX_STR, O_OPT, P_SYS | P_ACT, null, null], 'update' => [T_ZBX_STR, O_OPT, P_SYS | P_ACT, null, null], 'form' => [T_ZBX_STR, O_OPT, P_SYS, null, null], 'form_refresh' => [T_ZBX_INT, O_OPT, null, null, null], 'output' => [T_ZBX_STR, O_OPT, P_ACT, null, null], 'ajaxaction' => [T_ZBX_STR, O_OPT, P_ACT, null, null], 'ajaxdata' => [T_ZBX_STR, O_OPT, P_ACT | P_NO_TRIM, null, null]];
check_fields($fields);
/*
 * Ajax
 */
if (isset($_REQUEST['output']) && $_REQUEST['output'] == 'ajax') {
    $ajaxResponse = new CAjaxResponse();
    $ajaxData = getRequest('ajaxdata', []);
    if (isset($_REQUEST['ajaxaction']) && $_REQUEST['ajaxaction'] == 'test') {
        $result = ['expressions' => [], 'errors' => [], 'final' => true];
        $validator = new CRegexValidator(['messageInvalid' => _('Regular expression must be a string'), 'messageRegex' => _('Incorrect regular expression "%1$s": "%2$s"')]);
        foreach ($ajaxData['expressions'] as $id => $expression) {
            if (!in_array($expression['expression_type'], [EXPRESSION_TYPE_FALSE, EXPRESSION_TYPE_TRUE]) || $validator->validate($expression['expression'])) {
                $match = CGlobalRegexp::matchExpression($expression, $ajaxData['testString']);
                $result['expressions'][$id] = $match;
            } else {
开发者ID:jbfavre,项目名称:debian-zabbix,代码行数:31,代码来源:adm.regexps.php

示例11: array

**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
**/
require_once 'include/config.inc.php';
require_once 'include/triggers.inc.php';
require_once 'include/services.inc.php';
$page["title"] = "S_IT_SERVICES";
$page["file"] = "srv_status.php";
$page['scripts'] = array('services.js');
$page['hist_arg'] = array();
define('ZBX_PAGE_DO_REFRESH', 1);
include_once "include/page_header.php";
//		VAR			TYPE	OPTIONAL FLAGS	VALIDATION	EXCEPTION
$fields = array('serviceid' => array(T_ZBX_INT, O_OPT, P_SYS | P_NZERO, DB_ID, NULL), 'showgraph' => array(T_ZBX_INT, O_OPT, P_SYS, IN('1'), 'isset({serviceid})'), 'fullscreen' => array(T_ZBX_INT, O_OPT, P_SYS, IN('0,1'), NULL), 'favobj' => array(T_ZBX_STR, O_OPT, P_ACT, IN('"hat"'), NULL), 'favid' => array(T_ZBX_STR, O_OPT, P_ACT, NOT_EMPTY, 'isset({favobj})'), 'state' => array(T_ZBX_INT, O_OPT, P_ACT, NOT_EMPTY, 'isset({favobj})'));
check_fields($fields);
/* AJAX */
if (isset($_REQUEST['favobj'])) {
    if ('hat' == $_REQUEST['favobj']) {
        update_profile('web.srv_status.hats.' . $_REQUEST['favid'] . '.state', $_REQUEST['state'], PROFILE_TYPE_INT);
    }
}
if (PAGE_TYPE_JS == $page['type'] || PAGE_TYPE_HTML_BLOCK == $page['type']) {
    exit;
}
//--------
if (isset($_REQUEST['serviceid']) && $_REQUEST['serviceid'] > 0 && !DBfetch(DBselect('select serviceid from services where serviceid=' . $_REQUEST['serviceid']))) {
    unset($_REQUEST['serviceid']);
}
$available_hosts = get_accessible_hosts_by_user($USER_DETAILS, PERM_READ_ONLY, PERM_RES_IDS_ARRAY);
开发者ID:rennhak,项目名称:zabbix,代码行数:31,代码来源:srv_status.php

示例12: dirname

** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
**/
require_once dirname(__FILE__) . '/include/config.inc.php';
require_once dirname(__FILE__) . '/include/hosts.inc.php';
require_once dirname(__FILE__) . '/include/forms.inc.php';
$page['title'] = _('Host inventory overview');
$page['file'] = 'hostinventoriesoverview.php';
$page['hist_arg'] = array('groupid', 'hostid');
require_once dirname(__FILE__) . '/include/page_header.php';
//		VAR			TYPE	OPTIONAL FLAGS	VALIDATION	EXCEPTION
$fields = array('groupid' => array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, NULL), 'groupby' => array(T_ZBX_STR, O_OPT, P_SYS, DB_ID, NULL), 'sort' => array(T_ZBX_STR, O_OPT, P_SYS, IN('"host_count","inventory_field"'), null), 'sortorder' => array(T_ZBX_STR, O_OPT, P_SYS, IN('"' . ZBX_SORT_DOWN . '","' . ZBX_SORT_UP . '"'), null));
check_fields($fields);
$sortField = getRequest('sort', CProfile::get('web.' . $page['file'] . '.sort', 'host_count'));
$sortOrder = getRequest('sortorder', CProfile::get('web.' . $page['file'] . '.sortorder', ZBX_SORT_DOWN));
CProfile::update('web.' . $page['file'] . '.sort', $sortField, PROFILE_TYPE_STR);
CProfile::update('web.' . $page['file'] . '.sortorder', $sortOrder, PROFILE_TYPE_STR);
/*
 * Permissions
 */
if (getRequest('groupid') && !API::HostGroup()->isReadable(array($_REQUEST['groupid']))) {
    access_deny();
}
if (PAGE_TYPE_JS == $page['type'] || PAGE_TYPE_HTML_BLOCK == $page['type']) {
    require_once dirname(__FILE__) . '/include/page_footer.php';
    exit;
}
开发者ID:TonywalkerCN,项目名称:Zabbix,代码行数:31,代码来源:hostinventoriesoverview.php

示例13: get_item_function_info

function get_item_function_info($expr)
{
    $value_type = array(ITEM_VALUE_TYPE_UINT64 => _('Numeric (integer 64bit)'), ITEM_VALUE_TYPE_FLOAT => _('Numeric (float)'), ITEM_VALUE_TYPE_STR => _('Character'), ITEM_VALUE_TYPE_LOG => _('Log'), ITEM_VALUE_TYPE_TEXT => _('Text'));
    $type_of_value_type = array(ITEM_VALUE_TYPE_UINT64 => T_ZBX_INT, ITEM_VALUE_TYPE_FLOAT => T_ZBX_DBL, ITEM_VALUE_TYPE_STR => T_ZBX_STR, ITEM_VALUE_TYPE_LOG => T_ZBX_STR, ITEM_VALUE_TYPE_TEXT => T_ZBX_STR);
    $function_info = array('band' => array('value_type' => _('Numeric (integer 64bit)'), 'type' => T_ZBX_INT, 'validation' => NOT_EMPTY), 'abschange' => array('value_type' => $value_type, 'type' => $type_of_value_type, 'validation' => NOT_EMPTY), 'avg' => array('value_type' => $value_type, 'type' => $type_of_value_type, 'validation' => NOT_EMPTY), 'change' => array('value_type' => $value_type, 'type' => $type_of_value_type, 'validation' => NOT_EMPTY), 'count' => array('value_type' => _('Numeric (integer 64bit)'), 'type' => T_ZBX_INT, 'validation' => NOT_EMPTY), 'date' => array('value_type' => 'YYYYMMDD', 'type' => T_ZBX_INT, 'validation' => '{}>=19700101&&{}<=99991231'), 'dayofmonth' => array('value_type' => '1-31', 'type' => T_ZBX_INT, 'validation' => '{}>=1&&{}<=31'), 'dayofweek' => array('value_type' => '1-7', 'type' => T_ZBX_INT, 'validation' => IN('1,2,3,4,5,6,7')), 'delta' => array('value_type' => $value_type, 'type' => $type_of_value_type, 'validation' => NOT_EMPTY), 'diff' => array('value_type' => _('0 or 1'), 'type' => T_ZBX_INT, 'validation' => IN('0,1')), 'fuzzytime' => array('value_type' => _('0 or 1'), 'type' => T_ZBX_INT, 'validation' => IN('0,1')), 'iregexp' => array('value_type' => _('0 or 1'), 'type' => T_ZBX_INT, 'validation' => IN('0,1')), 'last' => array('value_type' => $value_type, 'type' => $type_of_value_type, 'validation' => NOT_EMPTY), 'logeventid' => array('value_type' => _('0 or 1'), 'type' => T_ZBX_INT, 'validation' => IN('0,1')), 'logseverity' => array('value_type' => _('Numeric (integer 64bit)'), 'type' => T_ZBX_INT, 'validation' => NOT_EMPTY), 'logsource' => array('value_type' => _('0 or 1'), 'type' => T_ZBX_INT, 'validation' => IN('0,1')), 'max' => array('value_type' => $value_type, 'type' => $type_of_value_type, 'validation' => NOT_EMPTY), 'min' => array('value_type' => $value_type, 'type' => $type_of_value_type, 'validation' => NOT_EMPTY), 'nodata' => array('value_type' => _('0 or 1'), 'type' => T_ZBX_INT, 'validation' => IN('0,1')), 'now' => array('value_type' => _('Numeric (integer 64bit)'), 'type' => T_ZBX_INT, 'validation' => NOT_EMPTY), 'prev' => array('value_type' => $value_type, 'type' => $type_of_value_type, 'validation' => NOT_EMPTY), 'regexp' => array('value_type' => _('0 or 1'), 'type' => T_ZBX_INT, 'validation' => IN('0,1')), 'str' => array('value_type' => _('0 or 1'), 'type' => T_ZBX_INT, 'validation' => IN('0,1')), 'strlen' => array('value_type' => _('Numeric (integer 64bit)'), 'type' => T_ZBX_INT, 'validation' => NOT_EMPTY), 'sum' => array('value_type' => $value_type, 'type' => $type_of_value_type, 'validation' => NOT_EMPTY), 'time' => array('value_type' => 'HHMMSS', 'type' => T_ZBX_INT, 'validation' => 'zbx_strlen({})==6'));
    $expressionData = new CTriggerExpression();
    if ($expressionData->parse($expr)) {
        if (isset($expressionData->macros[0])) {
            $result = array('value_type' => _('0 or 1'), 'type' => T_ZBX_INT, 'validation' => IN('0,1'));
        } elseif (isset($expressionData->usermacros[0]) || isset($expressionData->lldmacros[0])) {
            $result = array('value_type' => $value_type[ITEM_VALUE_TYPE_FLOAT], 'type' => T_ZBX_STR, 'validation' => 'preg_match("/^' . ZBX_PREG_NUMBER . '$/u", {})');
        } elseif (isset($expressionData->expressions[0])) {
            $exprPart = reset($expressionData->expressions);
            if (!isset($function_info[$exprPart['functionName']])) {
                return EXPRESSION_FUNCTION_UNKNOWN;
            }
            $hostFound = API::Host()->get(array('filter' => array('host' => array($exprPart['host'])), 'templated_hosts' => true));
            if (!$hostFound) {
                return EXPRESSION_HOST_UNKNOWN;
            }
            $itemFound = API::Item()->get(array('output' => array('value_type'), 'hostids' => zbx_objectValues($hostFound, 'hostid'), 'filter' => array('key_' => array($exprPart['item'])), 'webitems' => true));
            if (!$itemFound) {
                $itemFound = API::ItemPrototype()->get(array('output' => array('value_type'), 'hostids' => zbx_objectValues($hostFound, 'hostid'), 'filter' => array('key_' => array($exprPart['item']))));
                if (!$itemFound) {
                    return EXPRESSION_HOST_ITEM_UNKNOWN;
                }
            }
            $itemFound = reset($itemFound);
            $result = $function_info[$exprPart['functionName']];
            if (is_array($result['value_type'])) {
                $result['value_type'] = $result['value_type'][$itemFound['value_type']];
                $result['type'] = $result['type'][$itemFound['value_type']];
                if ($result['type'] == T_ZBX_INT || $result['type'] == T_ZBX_DBL) {
                    $result['type'] = T_ZBX_STR;
                    $result['validation'] = 'preg_match("/^' . ZBX_PREG_NUMBER . '$/u",{})';
                }
            }
        } else {
            return EXPRESSION_NOT_A_MACRO_ERROR;
        }
    }
    return $result;
}
开发者ID:SandipSingh14,项目名称:Zabbix_,代码行数:43,代码来源:triggers.inc.php

示例14: dirname

** but WITHOUT ANY WARRANTY; without even the implied warranty of
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
**/
require_once dirname(__FILE__) . '/include/config.inc.php';
require_once dirname(__FILE__) . '/include/services.inc.php';
$page['title'] = _('IT services availability report');
$page['file'] = 'report3.php';
$page['hist_arg'] = array();
require_once dirname(__FILE__) . '/include/page_header.php';
//	VAR			TYPE	OPTIONAL FLAGS	VALIDATION	EXCEPTION
$fields = array('serviceid' => array(T_ZBX_INT, O_MAND, P_SYS, DB_ID, null), 'period' => array(T_ZBX_STR, O_OPT, null, IN('"daily","weekly","monthly","yearly"'), null), 'year' => array(T_ZBX_INT, O_OPT, null, null, null));
check_fields($fields);
$period = getRequest('period', 'weekly');
$year = getRequest('year', date('Y'));
define('YEAR_LEFT_SHIFT', 5);
$service = API::Service()->get(array('output' => array('serviceid', 'name', 'showsla', 'goodsla'), 'serviceids' => $_REQUEST['serviceid']));
$service = reset($service);
if (!$service) {
    access_deny();
}
$form = new CForm();
$form->setMethod('get');
$form->addVar('serviceid', $_REQUEST['serviceid']);
$cmbPeriod = new CComboBox('period', $period, 'submit();');
$cmbPeriod->addItem('daily', _('Daily'));
$cmbPeriod->addItem('weekly', _('Weekly'));
开发者ID:TonywalkerCN,项目名称:Zabbix,代码行数:31,代码来源:report3.php

示例15: dirname

** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
** GNU General Public License for more details.
**
** You should have received a copy of the GNU General Public License
** along with this program; if not, write to the Free Software
** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
**/
require_once dirname(__FILE__) . '/include/config.inc.php';
require_once dirname(__FILE__) . '/include/hosts.inc.php';
require_once dirname(__FILE__) . '/include/forms.inc.php';
$page['title'] = _('Scripts');
$page['file'] = 'scripts_exec.php';
define('ZBX_PAGE_NO_MENU', 1);
require_once dirname(__FILE__) . '/include/page_header.php';
// VAR	TYPE	OPTIONAL	FLAGS	VALIDATION	EXCEPTION
$fields = array('hostid' => array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, 'isset({execute})'), 'scriptid' => array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, 'isset({execute})'), 'execute' => array(T_ZBX_INT, O_OPT, P_ACT, IN('0,1'), null));
check_fields($fields);
if (isset($_REQUEST['execute'])) {
    $scriptid = get_request('scriptid');
    $hostid = get_request('hostid');
    $data = array('message' => '', 'info' => DBfetch(DBselect('SELECT s.name FROM scripts s WHERE s.scriptid=' . zbx_dbstr($scriptid))));
    $result = API::Script()->execute(array('hostid' => $hostid, 'scriptid' => $scriptid));
    $isErrorExist = false;
    if (empty($result)) {
        $isErrorExist = true;
    } elseif ($result['response'] == 'failed') {
        error($result['value']);
        $isErrorExist = true;
    } else {
        $data['message'] = $result['value'];
    }
开发者ID:SandipSingh14,项目名称:Zabbix_,代码行数:31,代码来源:scripts_exec.php


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