0) { $destination_name = check_str($_POST["destination_name"]); $destination_context = check_str($_POST["destination_context"]); $destination_extension = check_str($_POST["destination_extension"]); $destination_enabled = check_str($_POST["destination_enabled"]); $destination_description = check_str($_POST["destination_description"]); } if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { $msg = ''; if ($action == "update") { $destination_uuid = check_str($_POST["destination_uuid"]); } //check for all required data //if (strlen($destination_name) == 0) { $msg .= "Please provide: Name
\n"; } //if (strlen($destination_context) == 0) { $msg .= "Please provide: Context
\n"; } //if (strlen($destination_extension) == 0) { $msg .= "Please provide: Extension
\n"; } //if (strlen($destination_enabled) == 0) { $msg .= "Please provide: Enabled
\n"; } //if (strlen($destination_description) == 0) { $msg .= "Please provide: Description
\n"; } if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { require_once "includes/header.php"; require_once "includes/persistformvar.php"; echo "
\n"; echo "
\n"; echo $msg."
"; echo "
\n"; persistformvar($_POST); echo "
\n"; require_once "includes/footer.php"; return; } //add or update the database if ($_POST["persistformvar"] != "true") { if ($action == "add") { $sql = "insert into v_destinations "; $sql .= "("; $sql .= "domain_uuid, "; $sql .= "destination_uuid, "; $sql .= "destination_name, "; $sql .= "destination_context, "; $sql .= "destination_extension, "; $sql .= "destination_enabled, "; $sql .= "destination_description "; $sql .= ")"; $sql .= "values "; $sql .= "("; $sql .= "'$domain_uuid', "; $sql .= "'".uuid()."', "; $sql .= "'$destination_name', "; $sql .= "'$destination_context', "; $sql .= "'$destination_extension', "; $sql .= "'$destination_enabled', "; $sql .= "'$destination_description' "; $sql .= ")"; $db->exec(check_sql($sql)); unset($sql); require_once "includes/header.php"; echo "\n"; echo "
\n"; echo "Add Complete\n"; echo "
\n"; require_once "includes/footer.php"; return; } //if ($action == "add") if ($action == "update") { $sql = "update v_destinations set "; $sql .= "destination_name = '$destination_name', "; $sql .= "destination_context = '$destination_context', "; $sql .= "destination_extension = '$destination_extension', "; $sql .= "destination_enabled = '$destination_enabled', "; $sql .= "destination_description = '$destination_description' "; $sql .= "where domain_uuid = '$domain_uuid' "; $sql .= "and destination_uuid = '$destination_uuid'"; $db->exec(check_sql($sql)); unset($sql); require_once "includes/header.php"; echo "\n"; echo "
\n"; echo "Update Complete\n"; echo "
\n"; require_once "includes/footer.php"; 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") { $destination_uuid = $_GET["id"]; $sql = "select * from v_destinations "; $sql .= "where domain_uuid = '$domain_uuid' "; $sql .= "and destination_uuid = '$destination_uuid' "; $prep_statement = $db->prepare(check_sql($sql)); $prep_statement->execute(); $result = $prep_statement->fetchAll(); foreach ($result as &$row) { $destination_name = $row["destination_name"]; $destination_context = $row["destination_context"]; $destination_extension = $row["destination_extension"]; $destination_enabled = $row["destination_enabled"]; $destination_description = $row["destination_description"]; break; //limit to 1 row } unset ($prep_statement); } //show the header require_once "includes/header.php"; //show the content echo "
"; echo "\n"; echo "\n"; echo " "; echo " "; echo "
\n"; echo "
"; echo "
\n"; echo "
\n"; echo "\n"; echo "\n"; if ($action == "add") { echo "\n"; } if ($action == "update") { echo "\n"; } echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo "\n"; echo " \n"; echo " \n"; echo " "; echo "
Destination AddDestination Edit
\n"; echo "An alias for a call destination. The destination will use the dialplan to find it its target.

\n"; echo "
\n"; echo " Name:\n"; echo "\n"; echo " \n"; echo "
\n"; echo "Enter the name.\n"; echo "
\n"; echo " Context:\n"; echo "\n"; echo " \n"; echo "
\n"; echo "Enter the context.\n"; echo "
\n"; echo " Extension:\n"; echo "\n"; echo " \n"; echo "
\n"; echo "Enter the extension.\n"; echo "
\n"; echo " Enabled:\n"; echo "\n"; echo " \n"; echo "
\n"; echo "\n"; echo "
\n"; echo " Description:\n"; echo "\n"; echo " \n"; echo "
\n"; echo "Enter the description.\n"; echo "
\n"; if ($action == "update") { echo " \n"; } echo " \n"; echo "
"; echo ""; echo "
"; echo "
"; //include the footer require_once "includes/footer.php"; ?>