$_SESSION['message'] = $text['message-add'];
            header('Location: access_control_edit.php?id=' . $access_control_uuid);
            return;
        }
        //if ($action == "add")
        if ($action == "update" && permission_exists('access_control_node_edit')) {
            $sql = "update v_access_control_nodes set ";
            $sql .= "access_control_uuid = '{$access_control_uuid}', ";
            $sql .= "node_type = '{$node_type}', ";
            $sql .= "node_cidr = '{$node_cidr}', ";
            $sql .= "node_domain = '{$node_domain}', ";
            $sql .= "node_description = '{$node_description}' ";
            $sql .= "where access_control_node_uuid = '{$access_control_node_uuid}'";
            $db->exec(check_sql($sql));
            unset($sql);
            remove_config_from_cache('configuration:acl.conf');
            $_SESSION['message'] = $text['message-update'];
            header('Location: access_control_edit.php?id=' . $access_control_uuid);
            return;
        }
        //if ($action == "update")
    }
    //if ($_POST["persistformvar"] != "true")
}
//(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
//pre-populate the form
if (count($_GET) > 0 && $_POST["persistformvar"] != "true") {
    $access_control_node_uuid = check_str($_GET["id"]);
    $sql = "select * from v_access_control_nodes ";
    $sql .= "where access_control_node_uuid = '{$access_control_node_uuid}' ";
    $prep_statement = $db->prepare(check_sql($sql));
            $sql .= "agent_password = '******', ";
            $sql .= "agent_contact = '{$agent_contact}', ";
            $sql .= "agent_status = '{$agent_status}', ";
            //$sql .= "agent_logout = '$agent_logout', ";
            $sql .= "agent_no_answer_delay_time = '{$agent_no_answer_delay_time}', ";
            $sql .= "agent_max_no_answer = '{$agent_max_no_answer}', ";
            $sql .= "agent_wrap_up_time = '{$agent_wrap_up_time}', ";
            $sql .= "agent_reject_delay_time = '{$agent_reject_delay_time}', ";
            $sql .= "agent_busy_delay_time = '{$agent_busy_delay_time}' ";
            $sql .= "where domain_uuid = '{$domain_uuid}'";
            $sql .= "and call_center_agent_uuid = '{$call_center_agent_uuid}'";
            $db->exec(check_sql($sql));
            unset($sql);
            //syncrhonize configuration
            save_call_center_xml();
            remove_config_from_cache('configuration:callcenter.conf');
            $_SESSION["message"] = $text['message-update'];
            header("Location: call_center_agents.php");
            return;
        }
        //if ($action == "update")
    }
    //if ($_POST["persistformvar"] != "true")
}
//(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0)
//initialize the destinations object
$destination = new destinations();
//pre-populate the form
if (count($_GET) > 0 && $_POST["persistformvar"] != "true") {
    $call_center_agent_uuid = $_GET["id"];
    $sql = "select * from v_call_center_agents ";