0) { //set the variables from the http values $call_flow_extension = check_str($_POST["call_flow_extension"]); $call_flow_feature_code = check_str($_POST["call_flow_feature_code"]); $call_flow_status = check_str($_POST["call_flow_status"]); $call_flow_pin_number = check_str($_POST["call_flow_pin_number"]); $call_flow_destination = check_str($_POST["call_flow_destination"]); $call_flow_alternate_destination = check_str($_POST["call_flow_alternate_destination"]); $call_flow_description = check_str($_POST["call_flow_description"]); //seperate the action and the param $destination_array = explode(":", $call_flow_destination); $call_flow_app = array_shift($destination_array); $call_flow_data = join(':', $destination_array); //seperate the action and the param call_flow_anti_app $alternate_destination_array = explode(":", $call_flow_alternate_destination); $call_flow_anti_app = array_shift($alternate_destination_array); $call_flow_anti_data = join(':', $alternate_destination_array); } if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { $msg = ''; if ($action == "update") { $call_flow_uuid = check_str($_POST["call_flow_uuid"]); } //check for all required data //if (strlen($call_flow_extension) == 0) { $msg .= "Please provide: Extension
\n"; } //if (strlen($call_flow_feature_code) == 0) { $msg .= "Please provide: Feature Code
\n"; } //if (strlen($call_flow_status) == 0) { $msg .= "Please provide: Status
\n"; } //if (strlen($call_flow_app) == 0) { $msg .= "Please provide: Application
\n"; } //if (strlen($call_flow_pin_number) == 0) { $msg .= "Please provide: PIN Number
\n"; } //if (strlen($call_flow_data) == 0) { $msg .= "Please provide: Application Data
\n"; } //if (strlen($call_flow_anti_app) == 0) { $msg .= "Please provide: Alternate Application
\n"; } //if (strlen($call_flow_anti_data) == 0) { $msg .= "Please provide: Application Data
\n"; } //if (strlen($call_flow_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" && permission_exists('call_flow_add')) { $sql = "insert into v_call_flows "; $sql .= "("; $sql .= "domain_uuid, "; $sql .= "call_flow_uuid, "; $sql .= "call_flow_extension, "; $sql .= "call_flow_feature_code, "; $sql .= "call_flow_status, "; $sql .= "call_flow_app, "; $sql .= "call_flow_pin_number, "; $sql .= "call_flow_data, "; $sql .= "call_flow_anti_app, "; $sql .= "call_flow_anti_data, "; $sql .= "call_flow_description "; $sql .= ")"; $sql .= "values "; $sql .= "("; $sql .= "'$domain_uuid', "; $sql .= "'".uuid()."', "; $sql .= "'$call_flow_extension', "; $sql .= "'$call_flow_feature_code', "; $sql .= "'$call_flow_status', "; $sql .= "'$call_flow_app', "; $sql .= "'$call_flow_pin_number', "; $sql .= "'$call_flow_data', "; $sql .= "'$call_flow_anti_app', "; $sql .= "'$call_flow_anti_data', "; $sql .= "'$call_flow_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" && permission_exists('call_flow_edit')) { $sql = "update v_call_flows set "; $sql .= "call_flow_extension = '$call_flow_extension', "; $sql .= "call_flow_feature_code = '$call_flow_feature_code', "; $sql .= "call_flow_status = '$call_flow_status', "; $sql .= "call_flow_pin_number = '$call_flow_pin_number', "; $sql .= "call_flow_app = '$call_flow_app', "; $sql .= "call_flow_data = '$call_flow_data', "; $sql .= "call_flow_anti_app = '$call_flow_anti_app', "; $sql .= "call_flow_anti_data = '$call_flow_anti_data', "; $sql .= "call_flow_description = '$call_flow_description' "; $sql .= "where domain_uuid = '$domain_uuid' "; $sql .= "and call_flow_uuid = '$call_flow_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") { $call_flow_uuid = check_str($_GET["id"]); $sql = "select * from v_call_flows "; $sql .= "where domain_uuid = '$domain_uuid' "; $sql .= "and call_flow_uuid = '$call_flow_uuid' "; $prep_statement = $db->prepare(check_sql($sql)); $prep_statement->execute(); $result = $prep_statement->fetchAll(); foreach ($result as &$row) { //set the php variables $call_flow_extension = $row["call_flow_extension"]; $call_flow_feature_code = $row["call_flow_feature_code"]; $call_flow_status = $row["call_flow_status"]; $call_flow_app = $row["call_flow_app"]; $call_flow_pin_number = $row["call_flow_pin_number"]; $call_flow_data = $row["call_flow_data"]; $call_flow_anti_app = $row["call_flow_anti_app"]; $call_flow_anti_data = $row["call_flow_anti_data"]; $call_flow_description = $row["call_flow_description"]; //if superadmin show both the app and data if (if_group("superadmin")) { $destination_label = $call_flow_app.':'.$call_flow_data; } else { $destination_label = $call_flow_data; } //if superadmin show both the app and data if (if_group("superadmin")) { $alternate_destination_label = $call_flow_anti_app.':'.$call_flow_anti_data; } else { $alternate_destination_label = $call_flow_anti_data; } } 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"; 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 "\n"; echo "\n"; echo "\n"; echo " \n"; echo " \n"; echo " "; echo "
Call Flow
\n"; echo " Extension:\n"; echo "\n"; echo " \n"; echo "
\n"; echo "Enter the extension number.\n"; echo "
\n"; echo " Feature Code:\n"; echo "\n"; echo " \n"; echo "
\n"; echo "Enter the feature code.\n"; echo "
\n"; echo " Status:\n"; echo "\n"; echo " \n"; echo "
\n"; echo "Select the status.\n"; echo "
\n"; echo " PIN Number:\n"; echo "\n"; echo " \n"; echo "
\n"; echo "Enter the pin number\n"; echo "
\n"; echo " Destination:\n"; echo "\n"; $select_value = ''; //set the selected value if (strlen($call_flow_app.$call_flow_data) > 0) { $select_value = $call_flow_app.':'.$call_flow_data; } //show the destination list //switch_select_destination($select_type, $select_label, $select_name, $select_value, $select_style, $action='') switch_select_destination("dialplan", $destination_label, "call_flow_destination", $select_value, "", $call_flow_data); unset($select_value); echo "
\n"; echo "Select the destination.\n"; echo "
\n"; echo " Alternate Destination:\n"; echo "\n"; //switch_select_destination($select_type, $select_label, $select_name, $select_value, $select_style, $action='') $select_value = ''; if (strlen($call_flow_anti_app.$call_flow_anti_data) > 0) { $select_value = $call_flow_anti_app.':'.$call_flow_anti_data; } switch_select_destination("dialplan", $alternate_destination_label, "call_flow_alternate_destination", $select_value, "", $call_flow_anti_data); unset($select_value); echo "
\n"; echo "Select the alternate destination.\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"; ?>