}
    $list = '<ul>' . $list_items . '</ul>';
    NConf_DEBUG::set($list, 'ERROR');
    # When user clicks on a listed item, and goes to delete it, the redirect must know where to go after delete, this would be the add page:
    $_SESSION["after_delete_page"] = $_SERVER["HTTP_REFERER"];
    message($debug, 'Setting after delete page to : ' . $_SERVER["HTTP_REFERER"]);
    $write2db = "no";
} else {
    #entry not existing
    # Check mandatory fields
    $m_array = db_templates("mandatory", $config_class);
    $write2db = check_mandatory($m_array, $_POST);
    # 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") {
        ################
        #### write to db
        ################
        # get class id
        $class_id = db_templates("get_id_of_class", $config_class);
        $query = 'INSERT INTO ConfigItems
                    (id_item, fk_id_class)
                    VALUES
                    (NULL, "' . $class_id . '" )
                    ';
        if (DB_NO_WRITES != 1) {
}
if (isset($_POST["HIDDEN_config_class"]) and $_POST["HIDDEN_config_class"] != "") {
    $config_class = $_POST["HIDDEN_config_class"];
}
$array_ids = explode(",", $_POST["HIDDEN_modify_ids"]);
# predefine ask vererben variable:
$ask_vererben = 0;
# ONCALL CHECK
# check oncall groups when try modifying it and class is host, service or advanced-service
# but not if the replace mode is "add"
if (isset($_POST["multimodify"]) and ($config_class == "host" or $config_class == "service" or $config_class == "advanced-service") and !(!empty($_POST["replace_mode"]) and $_POST["replace_mode"] == "add")) {
    # get id of contact_group attr
    $contact_group_id = db_templates("get_attr_id", $config_class, "contact_groups");
    if (isset($_POST[$contact_group_id])) {
        # if failed do not allow write2db
        $oncall_check = oncall_check();
    }
}
# Check mandatory fields
while ($attr = each($_POST)) {
    if (is_int($attr["key"])) {
        # Check mandatory fields
        $m_array = db_templates("mandatory", $config_class, $attr["key"]);
        if (check_mandatory($m_array, $_POST) == "no") {
            $write2db = "no";
        }
    }
}
# Give error message if oncall or mandatory check fails
if (isset($oncall_check) and $oncall_check === FALSE or isset($write2db) and $write2db == "no") {
    $content = NConf_HTML::show_error();