Beispiel #1
0
                            }
                        } else {
                            $id = $new_timeperiod['id'];
                            unset($new_timeperiod['id']);
                            $_REQUEST['timeperiods'][$id] = $new_timeperiod;
                        }
                        unset($_REQUEST['new_timeperiod']);
                    }
                } else {
                    if (inarr_isset(array('del_timeperiod', 'g_timeperiodid'))) {
                        $_REQUEST['timeperiods'] = get_request('timeperiods', array());
                        foreach ($_REQUEST['g_timeperiodid'] as $val) {
                            unset($_REQUEST['timeperiods'][$val]);
                        }
                    } else {
                        if (inarr_isset(array('edit_timeperiodid'))) {
                            $_REQUEST['edit_timeperiodid'] = array_keys($_REQUEST['edit_timeperiodid']);
                            $edit_timeperiodid = $_REQUEST['edit_timeperiodid'] = array_pop($_REQUEST['edit_timeperiodid']);
                            $_REQUEST['timeperiods'] = get_request('timeperiods', array());
                            if (isset($_REQUEST['timeperiods'][$edit_timeperiodid])) {
                                $_REQUEST['new_timeperiod'] = $_REQUEST['timeperiods'][$edit_timeperiodid];
                                $_REQUEST['new_timeperiod']['id'] = $edit_timeperiodid;
                            }
                        }
                    }
                }
            }
        }
    }
}
$available_hosts = get_accessible_hosts_by_user($USER_DETAILS, PERM_READ_WRITE, null, null, AVAILABLE_NOCACHE);
     show_messages($result, $msg_ok, $msg_fail);
     if ($result) {
         // result - OK
         add_audit(!isset($_REQUEST['druleid']) ? AUDIT_ACTION_ADD : AUDIT_ACTION_UPDATE, AUDIT_RESOURCE_DISCOVERY_RULE, '[' . $druleid . '] ' . $_REQUEST['name']);
         unset($_REQUEST['form']);
     }
 } else {
     if (inarr_isset(array('clone', 'druleid'))) {
         unset($_REQUEST["druleid"]);
         $dchecks = $_REQUEST['dchecks'];
         foreach ($dchecks as $id => $data) {
             unset($dchecks[$id]['dcheckid']);
         }
         $_REQUEST["form"] = "clone";
     } else {
         if (inarr_isset(array('delete', 'druleid'))) {
             $result = delete_discovery_rule($_REQUEST['druleid']);
             show_messages($result, S_DISCOVERY_RULE_DELETED, S_CANNOT_DELETE_DISCOVERY_RULE);
             if ($result) {
                 add_audit(AUDIT_ACTION_DELETE, AUDIT_RESOURCE_DISCOVERY_RULE, '[' . $_REQUEST['druleid'] . ']');
                 unset($_REQUEST['form']);
                 unset($_REQUEST['druleid']);
             }
         } else {
             if (str_in_array($_REQUEST['go'], array('activate', 'disable')) && isset($_REQUEST['g_druleid'])) {
                 $status = $_REQUEST['go'] == 'activate' ? DRULE_STATUS_ACTIVE : DRULE_STATUS_DISABLED;
                 $go_result = false;
                 foreach ($_REQUEST['g_druleid'] as $drid) {
                     if (set_discovery_rule_status($drid, $status)) {
                         $rule_data = get_discovery_rule_by_druleid($drid);
                         add_audit(AUDIT_ACTION_UPDATE, AUDIT_RESOURCE_DISCOVERY_RULE, '[' . $drid . '] ' . $rule_data['name']);
Beispiel #3
0
                     if (inarr_isset('group_disable') || inarr_isset('group_enable')) {
                         $status = DRULE_STATUS_ACTIVE;
                         if (isset($_REQUEST['group_disable'])) {
                             $status = DRULE_STATUS_DISABLED;
                         }
                         $result = false;
                         foreach ($_REQUEST['g_druleid'] as $drid) {
                             if (set_discovery_rule_status($drid, $status)) {
                                 $rule_data = get_discovery_rule_by_druleid($drid);
                                 add_audit(AUDIT_ACTION_UPDATE, AUDIT_RESOURCE_DISCOVERY_RULE, '[' . $drid . '] ' . $rule_data['name']);
                                 $result = true;
                             }
                         }
                         show_messages($result, S_DISCOVERY_RULES_UPDATED);
                     } else {
                         if (inarr_isset('group_delete')) {
                             $result = false;
                             foreach ($_REQUEST['g_druleid'] as $drid) {
                                 if (delete_discovery_rule($drid)) {
                                     add_audit(AUDIT_ACTION_DELETE, AUDIT_RESOURCE_DISCOVERY_RULE, '[' . $drid . ']');
                                     $result = true;
                                 }
                             }
                             show_messages($result, S_DISCOVERY_RULES_DELETED);
                         }
                     }
                 }
             }
         }
     }
 }
Beispiel #4
0
                 unset($new_operation['id']);
                 $_REQUEST['operations'][$id] = $new_operation;
             }
             unset($_REQUEST['new_operation']);
         } else {
             info(S_INCORRECT_STEPS);
         }
     }
 } else {
     if (inarr_isset(array('del_operation', 'g_operationid'))) {
         $_REQUEST['operations'] = get_request('operations', array());
         foreach ($_REQUEST['g_operationid'] as $val) {
             unset($_REQUEST['operations'][$val]);
         }
     } else {
         if (inarr_isset(array('edit_operationid'))) {
             $_REQUEST['edit_operationid'] = array_keys($_REQUEST['edit_operationid']);
             $edit_operationid = $_REQUEST['edit_operationid'] = array_pop($_REQUEST['edit_operationid']);
             $_REQUEST['operations'] = get_request('operations', array());
             if (isset($_REQUEST['operations'][$edit_operationid])) {
                 $_REQUEST['new_operation'] = $_REQUEST['operations'][$edit_operationid];
                 $_REQUEST['new_operation']['id'] = $edit_operationid;
             }
         } else {
             if (str_in_array($_REQUEST['go'], array('activate', 'disable')) && isset($_REQUEST['g_actionid'])) {
                 if (!count($nodes = get_accessible_nodes_by_user($USER_DETAILS, PERM_READ_WRITE, PERM_RES_IDS_ARRAY))) {
                     access_deny();
                 }
                 $status = $_REQUEST['go'] == 'activate' ? 0 : 1;
                 $status_name = $status ? 'disabled' : 'enabled';
                 DBstart();
Beispiel #5
0
                                 }
                             } else {
                                 $id = $new_expression['id'];
                                 unset($new_expression['id']);
                                 $_REQUEST['expressions'][$id] = $new_expression;
                             }
                             unset($_REQUEST['new_expression']);
                         }
                     } else {
                         if (inarr_isset(array('delete_expression', 'g_expressionid'))) {
                             $_REQUEST['expressions'] = get_request('expressions', array());
                             foreach ($_REQUEST['g_expressionid'] as $val) {
                                 unset($_REQUEST['expressions'][$val]);
                             }
                         } else {
                             if (inarr_isset(array('edit_expressionid'))) {
                                 $_REQUEST['edit_expressionid'] = array_keys($_REQUEST['edit_expressionid']);
                                 $edit_expressionid = $_REQUEST['edit_expressionid'] = array_pop($_REQUEST['edit_expressionid']);
                                 $_REQUEST['expressions'] = get_request('expressions', array());
                                 if (isset($_REQUEST['expressions'][$edit_expressionid])) {
                                     $_REQUEST['new_expression'] = $_REQUEST['expressions'][$edit_expressionid];
                                     $_REQUEST['new_expression']['id'] = $edit_expressionid;
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
 }