예제 #1
0
function prepare_check_command_params($values)
{
    # Implode the splitet fields (exploded in handle_item.php)
    if (is_array($values)) {
        NConf_DEBUG::open_group("params for check command");
        foreach ($values as $field_key => $value_array) {
            # trim values
            NConf_DEBUG::set($value_array, '', "bevore trimming");
            $value_array_trimmed = array();
            foreach ($value_array as $value) {
                $value_array_trimmed[] = trim($value);
            }
            NConf_DEBUG::set($value_array_trimmed, '', "after trimming");
            if (array_diff($value_array, $value_array_trimmed)) {
                NConf_DEBUG::set("trimmed check command params", 'INFO');
            }
            # string starts with a "!"
            $imploded = "!";
            # implode the other arguments
            $imploded .= implode("!", $value_array_trimmed);
            # Save it to the POST-var, so the var will be added later in the script
            $_POST[$field_key] = $imploded;
        }
        NConf_DEBUG::close_group();
    }
}
예제 #2
0
         unset($m_array[$check_command_attr_id]);
     }
     if (isset($m_array[$host_name_attr_id])) {
         unset($m_array[$host_name_attr_id]);
     }
     NConf_DEBUG::set($m_array, 'DEBUG', "after special case for service");
 } elseif ($config_class == "advanced-service") {
     # - class: advanced-service
     $check_command_attr_id = db_templates("get_attr_id", $config_class, "check_command");
     if (isset($m_array[$check_command_attr_id])) {
         unset($m_array[$check_command_attr_id]);
     }
     NConf_DEBUG::set($m_array, 'DEBUG', "after special case for advanced-service");
 }
 $write2db = check_mandatory($m_array, $_POST);
 NConf_DEBUG::close_group();
 # check oncall groups when class is host, service or advanced-service
 if ($config_class == "host" or $config_class == "service" or $config_class == "advanced-service") {
     # if failed do not allow write2db
     if (oncall_check() == FALSE) {
         $write2db = 'no';
     }
 }
 if ($write2db == "yes" and !NConf_DEBUG::status('ERROR')) {
     ################
     #### write to db
     ################
     # get class id
     $class_id = db_templates("get_id_of_class", $config_class);
     # history entry status for "edited"
     $edited = FALSE;