From 8f5a15717b35115f0102309e74dc534718951ecc Mon Sep 17 00:00:00 2001 From: Mark Crane Date: Fri, 10 Aug 2012 16:29:57 +0000 Subject: [PATCH] Add the fax_copy.php file. --- app/fax/fax_copy.php | 113 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 113 insertions(+) create mode 100644 app/fax/fax_copy.php diff --git a/app/fax/fax_copy.php b/app/fax/fax_copy.php new file mode 100644 index 0000000000..bbe3d6f9e2 --- /dev/null +++ b/app/fax/fax_copy.php @@ -0,0 +1,113 @@ + + Portions created by the Initial Developer are Copyright (C) 2008-2012 + the Initial Developer. All Rights Reserved. + + Contributor(s): + Mark J Crane +*/ +include "root.php"; +require_once "includes/require.php"; +require_once "includes/checkauth.php"; +require_once "includes/paging.php"; +if (permission_exists('fax_extension_add')) { + //access granted +} +else { + echo "access denied"; + exit; +} + +//set the http get/post variable(s) to a php variable + if (isset($_REQUEST["id"])) { + $fax_uuid = check_str($_REQUEST["id"]); + } + +//get the data + $sql = "select * from v_fax "; + $sql .= "where domain_uuid = '".$_SESSION['domain_uuid']."' "; + $sql .= "and fax_uuid = '$fax_uuid' "; + $prep_statement = $db->prepare(check_sql($sql)); + $prep_statement->execute(); + $result = $prep_statement->fetchAll(PDO::FETCH_NAMED); + if (count($result) == 0) { + echo "access denied"; + exit; + } + foreach ($result as &$row) { + $fax_extension = $row["fax_extension"]; + $fax_name = $row["fax_name"]; + $fax_email = $row["fax_email"]; + $fax_pin_number = $row["fax_pin_number"]; + $fax_caller_id_name = $row["fax_caller_id_name"]; + $fax_caller_id_number = $row["fax_caller_id_number"]; + $fax_forward_number = $row["fax_forward_number"]; + $fax_description = 'copy: '.$row["fax_description"]; + } + unset ($prep_statement); + +//copy the fax extension + $fax_uuid = uuid(); + $dialplan_uuid = uuid(); + $sql = "insert into v_fax "; + $sql .= "("; + $sql .= "domain_uuid, "; + $sql .= "fax_uuid, "; + $sql .= "dialplan_uuid, "; + $sql .= "fax_extension, "; + $sql .= "fax_name, "; + $sql .= "fax_email, "; + $sql .= "fax_pin_number, "; + $sql .= "fax_caller_id_name, "; + $sql .= "fax_caller_id_number, "; + if (strlen($fax_forward_number) > 0) { + $sql .= "fax_forward_number, "; + } + $sql .= "fax_description "; + $sql .= ")"; + $sql .= "values "; + $sql .= "("; + $sql .= "'".$_SESSION['domain_uuid']."', "; + $sql .= "'$fax_uuid', "; + $sql .= "'$dialplan_uuid', "; + $sql .= "'$fax_extension', "; + $sql .= "'$fax_name', "; + $sql .= "'$fax_email', "; + $sql .= "'$fax_pin_number', "; + $sql .= "'$fax_caller_id_name', "; + $sql .= "'$fax_caller_id_number', "; + if (strlen($fax_forward_number) > 0) { + $sql .= "'$fax_forward_number', "; + } + $sql .= "'$fax_description' "; + $sql .= ")"; + $db->exec(check_sql($sql)); + unset($sql); + +//redirect the user + require_once "includes/header.php"; + echo "\n"; + echo "
\n"; + echo "Copy Complete\n"; + echo "
\n"; + require_once "includes/footer.php"; + return; + +?> \ No newline at end of file