Exemple #1
0
                 if ($result &= disable_item($item['itemid'])) {
                     /*							$host = get_host_by_hostid($item['hostid']);
                     							add_audit(AUDIT_ACTION_UPDATE, AUDIT_RESOURCE_ITEM,S_ITEM.' ['.$item['key_'].'] ['.$id.'] '.S_HOST.' ['.$host['host'].'] '.S_ITEMS_DISABLED);*/
                 }
             }
         }
     }
     $result = DBend($result);
     isset($_REQUEST['activate']) ? show_messages($result, S_ITEMS_ACTIVATED, null) : show_messages($result, S_ITEMS_DISABLED, null);
 } else {
     if ($_REQUEST['config'] == 5 && isset($_REQUEST['save'])) {
         $result = true;
         $hosts = get_request('hosts', array());
         DBstart();
         if (isset($_REQUEST['hostid'])) {
             $result = update_proxy($_REQUEST['hostid'], $_REQUEST['host'], $hosts);
             $action = AUDIT_ACTION_UPDATE;
             $msg_ok = S_PROXY_UPDATED;
             $msg_fail = S_CANNOT_UPDATE_PROXY;
             $hostid = $_REQUEST['hostid'];
         } else {
             if (!count(get_accessible_nodes_by_user($USER_DETAILS, PERM_READ_WRITE, PERM_RES_IDS_ARRAY))) {
                 access_deny();
             }
             $hostid = add_proxy($_REQUEST['host'], $hosts);
             $action = AUDIT_ACTION_ADD;
             $msg_ok = S_PROXY_ADDED;
             $msg_fail = S_CANNOT_ADD_PROXY;
         }
         $result = DBend($result);
         show_messages($result, $msg_ok, $msg_fail);
Exemple #2
0
require_once 'include/hosts.inc.php';
$page['title'] = 'S_PROXIES';
$page['file'] = 'proxies.php';
$page['hist_arg'] = array('');
include_once 'include/page_header.php';
//		VAR			TYPE	OPTIONAL FLAGS	VALIDATION	EXCEPTION
$fields = array('hostid' => array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, 'isset({form})&&({form}=="update")'), 'host' => array(T_ZBX_STR, O_OPT, NULL, NOT_EMPTY, 'isset({save})'), 'status' => array(T_ZBX_INT, O_OPT, NULL, BETWEEN(HOST_STATUS_PROXY_ACTIVE, HOST_STATUS_PROXY_PASSIVE), 'isset({save})'), 'useip' => array(T_ZBX_STR, O_OPT, NULL, IN('0,1'), 'isset({save})'), 'dns' => array(T_ZBX_STR, O_OPT, NULL, NULL, 'isset({save})'), 'ip' => array(T_ZBX_IP, O_OPT, NULL, NULL, 'isset({save})'), 'port' => array(T_ZBX_INT, O_OPT, NULL, BETWEEN(0, 65535), 'isset({save})'), 'hosts' => array(T_ZBX_INT, O_OPT, P_SYS, DB_ID, NULL), 'go' => array(T_ZBX_STR, O_OPT, P_SYS | P_ACT, NULL, NULL), 'save' => array(T_ZBX_STR, O_OPT, P_SYS | P_ACT, NULL, NULL), 'clone' => 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, NULL, NULL), 'form' => array(T_ZBX_STR, O_OPT, P_SYS, NULL, NULL), 'form_refresh' => array(T_ZBX_STR, O_OPT, NULL, NULL, NULL));
check_fields($fields);
validate_sort_and_sortorder('host', ZBX_SORT_UP);
$_REQUEST['go'] = get_request('go', 'none');
if (isset($_REQUEST['save'])) {
    $result = true;
    $hosts = get_request('hosts', array());
    DBstart();
    if (isset($_REQUEST['hostid'])) {
        $result = update_proxy($_REQUEST['hostid'], $_REQUEST['host'], $_REQUEST['status'], $_REQUEST['useip'], $_REQUEST['dns'], $_REQUEST['ip'], $_REQUEST['port'], $hosts);
        $action = AUDIT_ACTION_UPDATE;
        $msg_ok = S_PROXY_UPDATED;
        $msg_fail = S_CANNOT_UPDATE_PROXY;
        $hostid = $_REQUEST['hostid'];
    } else {
        if (!count(get_accessible_nodes_by_user($USER_DETAILS, PERM_READ_WRITE, PERM_RES_IDS_ARRAY))) {
            access_deny();
        }
        $result = $hostid = add_proxy($_REQUEST['host'], $_REQUEST['status'], $_REQUEST['useip'], $_REQUEST['dns'], $_REQUEST['ip'], $_REQUEST['port'], $hosts);
        $action = AUDIT_ACTION_ADD;
        $msg_ok = S_PROXY_ADDED;
        $msg_fail = S_CANNOT_ADD_PROXY;
    }
    $result = DBend($result);
    show_messages($result, $msg_ok, $msg_fail);