Fax Server: Database class integration.

This commit is contained in:
Nate
2019-08-07 18:59:26 -06:00
parent e94f154ee4
commit d23c5d84c4
16 changed files with 836 additions and 940 deletions
+20 -17
View File
@@ -45,26 +45,25 @@
}
//get the id
if (isset($_REQUEST["id"])) {
$fax_file_uuid = check_str($_REQUEST["id"]);
}
$fax_file_uuid = $_REQUEST["id"];
//validate the id
if (is_uuid($fax_file_uuid)) {
//get the fax file data
$sql = "select * from v_fax_files ";
$sql .= "where fax_file_uuid = '".$fax_file_uuid."' ";
$sql .= "and domain_uuid = '".$_SESSION['domain_uuid']."' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
$result = $prep_statement->fetchAll(PDO::FETCH_NAMED);
foreach ($result as &$row) {
$sql .= "where fax_file_uuid = :fax_file_uuid ";
$sql .= "and domain_uuid = :domain_uuid ";
$parameters['fax_file_uuid'] = $fax_file_uuid;
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
$database = new database;
$row = $database->select($sql, $parameters, 'row');
if (is_array($row) && @sizeof($row) != 0) {
$fax_uuid = $row["fax_uuid"];
$fax_mode = $row["fax_mode"];
$fax_file_path = $row["fax_file_path"];
$fax_file_type = $row["fax_file_type"];
}
unset($prep_statement);
unset($sql, $parameters, $row);
//set the type
if ($fax_mode == 'rx') { $type = 'inbox'; }
@@ -91,17 +90,21 @@
}
//delete fax file record
$sql = "delete from v_fax_files ";
$sql .= "where fax_file_uuid = '".$fax_file_uuid."' ";
$sql .= "and domain_uuid = '".$_SESSION['domain_uuid']."' ";
$prep_statement = $db->prepare(check_sql($sql));
$prep_statement->execute();
unset($prep_statement);
$array['fax_files'][0]['fax_file_uuid'] = $fax_file_uuid;
$array['fax_files'][0]['domain_uuid'] = $_SESSION['domain_uuid'];
message::add($text['message-delete']);
$database = new database;
$database->app_name = 'fax';
$database->app_uuid = '24108154-4ac3-1db6-1551-4731703a4440';
$database->delete($array);
unset($array);
//set message
message::add($text['message-delete']);
}
//redirect the user
header('Location: fax_files.php?id='.$fax_uuid.'&box='.$type);
exit;
?>