Portions created by the Initial Developer are Copyright (C) 2013 the Initial Developer. All Rights Reserved. Contributor(s): Mark J Crane */ require_once "root.php"; require_once "resources/require.php"; require_once "resources/check_auth.php"; //check permissions if (permission_exists('ring_group_add') || permission_exists('ring_group_edit') || permission_exists('ring_group_forward')) { //access granted } else { echo "access denied"; exit; } //add multi-lingual support require_once "app_languages.php"; foreach($text as $key => $value) { $text[$key] = $value[$_SESSION['domain']['language']['code']]; } //show the header require_once "resources/header.php"; //$document['title'] = $text['title-ring_group_forward']; //get the hunt_group_uuid $ring_group_uuid = check_str($_REQUEST["id"]); //process the HTTP post if (count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) { //get http post variables and set them to php variables if (count($_POST)>0) { $ring_group_forward_enabled = check_str($_POST["ring_group_forward_enabled"]); $ring_group_forward_destination = check_str($_POST["ring_group_forward_destination"]); if (strlen($ring_group_forward_destination) > 0) { $ring_group_forward_destination = preg_replace("~[^0-9]~", "",$ring_group_forward_destination); } } //check for all required data //if (strlen($ring_group_forward_enabled) == 0) { $msg .= $text['message-required'].$text['label-call_forward']."
\n"; } //if (strlen($ring_group_forward_destination) == 0) { $msg .= $text['message-required'].$text['label-number']."
\n"; } if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) { require_once "resources/header.php"; require_once "resources/persist_form_var.php"; echo "
\n"; echo "
\n"; echo $msg."
"; echo "
\n"; persistformvar($_POST); echo "
\n"; require_once "resources/footer.php"; return; } //update the ring group $sql = "update v_ring_groups set "; $sql .= "ring_group_forward_enabled = '$ring_group_forward_enabled', "; $sql .= "ring_group_forward_destination = '$ring_group_forward_destination' "; $sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' "; $sql .= "and ring_group_uuid = '$ring_group_uuid' "; $db->exec(check_sql($sql)); unset($sql); //redirect the user $_SESSION["message"] = $text['message-update']; header("Location: ".PROJECT_PATH."/app/ring_groups/ring_group_forward.php"); return; } //(count($_POST)>0 && strlen($_POST["persistformvar"]) == 0) //pre-populate the form if (count($_GET) > 0 && $_POST["persistformvar"] != "true") { $ring_group_uuid = $_GET["id"]; $sql = "select * from v_ring_groups "; $sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' "; $sql .= "and ring_group_uuid = '$ring_group_uuid' "; $prep_statement = $db->prepare(check_sql($sql)); $prep_statement->execute(); $result = $prep_statement->fetchAll(); foreach ($result as &$row) { $ring_group_name = $row["ring_group_name"]; $ring_group_extension = $row["ring_group_extension"]; $ring_group_forward_enabled = $row["ring_group_forward_enabled"]; $ring_group_forward_destination = $row["ring_group_forward_destination"]; $ring_group_description = $row["ring_group_description"]; } unset ($prep_statement); } //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 " "; echo "
\n"; echo " ".$text['header-ring-group-forward']."\n"; echo "\n"; echo " \n"; echo " \n"; echo "
\n"; echo " ".$text['description-ring-group-forward']." ".$ring_group_extension."

\n"; echo "
\n"; echo " ".$text['label-call-forward']."\n"; echo "\n"; if ($ring_group_forward_enabled == "true") { echo " ".$text['option-enabled']." \n"; } else { echo " ".$text['option-enabled']." \n"; } if ($ring_group_forward_enabled == "false" || $ring_group_forward_enabled == "") { echo " ".$text['option-disabled']." \n"; } else { echo " ".$text['option-disabled']." \n"; } echo "
\n"; echo "
\n"; echo "
\n"; echo " ".$text['label-forward_destination']."\n"; echo "\n"; echo " \n"; echo "
\n"; echo "
\n"; echo "
\n"; echo "
\n"; echo " \n"; echo " \n"; echo "
"; echo "
"; echo "
"; echo "
"; //show the footer require_once "resources/footer.php"; ?>