Add a new FAX Queue

This commit is contained in:
markjcrane
2022-03-31 12:24:00 -06:00
parent 504228c2f8
commit 35fa6a2a08
12 changed files with 2537 additions and 200 deletions

View File

@@ -17,7 +17,7 @@
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2008-2021
Portions created by the Initial Developer are Copyright (C) 2008-2022
the Initial Developer. All Rights Reserved.
Contributor(s):
@@ -87,13 +87,13 @@ if (!$included) {
$row = $database->select($sql, $parameters, 'row');
if (is_array($row) && @sizeof($row) != 0) {
//set database fields as variables
$fax_uuid = $row["fax_uuid"];
$fax_extension = $row["fax_extension"];
$fax_caller_id_name = $row["fax_caller_id_name"];
$fax_caller_id_number = $row["fax_caller_id_number"];
$fax_toll_allow = $row["fax_toll_allow"];
$fax_accountcode = $row["accountcode"];
$fax_send_greeting = $row["fax_send_greeting"];
$fax_uuid = $row["fax_uuid"];
$fax_extension = $row["fax_extension"];
$fax_caller_id_name = $row["fax_caller_id_name"];
$fax_caller_id_number = $row["fax_caller_id_number"];
$fax_toll_allow = $row["fax_toll_allow"];
$fax_accountcode = $row["accountcode"];
$fax_send_greeting = $row["fax_send_greeting"];
}
else {
if (!permission_exists('fax_extension_view_domain')) {
@@ -102,11 +102,6 @@ if (!$included) {
}
}
unset($sql, $parameters, $row);
$fax_send_mode = $_SESSION['fax']['send_mode']['text'];
if(strlen($fax_send_mode) == 0){
$fax_send_mode = 'direct';
}
}
//set the fax directory
@@ -139,69 +134,6 @@ if (!function_exists('gs_cmd')) {
}
}
if (!function_exists('fax_enqueue')) {
function fax_enqueue($fax_uuid, $fax_file, $wav_file, $reply_address, $fax_uri, $fax_dtmf, $dial_string){
global $db_type;
$fax_task_uuid = uuid();
$dial_string .= "fax_task_uuid='" . $fax_task_uuid . "',";
$description = ''; //! @todo add description
if ($db_type == "pgsql") {
$date_utc_now_sql = "NOW() at time zone 'utc'";
}
if ($db_type == "mysql") {
$date_utc_now_sql = "UTC_TIMESTAMP()";
}
if ($db_type == "sqlite") {
$date_utc_now_sql = "datetime('now')";
}
$array['fax_tasks'][0]['fax_task_uuid'] = $fax_task_uuid;
$array['fax_tasks'][0]['fax_uuid'] = $fax_uuid;
$array['fax_tasks'][0]['task_next_time'] = $date_utc_now_sql;
$array['fax_tasks'][0]['task_lock_time'] = null;
$array['fax_tasks'][0]['task_fax_file'] = $fax_file;
$array['fax_tasks'][0]['task_wav_file'] = $wav_file;
$array['fax_tasks'][0]['task_uri'] = $fax_uri;
$array['fax_tasks'][0]['task_dial_string'] = $dial_string;
$array['fax_tasks'][0]['task_dtmf'] = $fax_dtmf;
$array['fax_tasks'][0]['task_interrupted'] = 'false';
$array['fax_tasks'][0]['task_status'] = 0;
$array['fax_tasks'][0]['task_no_answer_counter'] = 0;
$array['fax_tasks'][0]['task_no_answer_retry_counter'] = 0;
$array['fax_tasks'][0]['task_retry_counter'] = 0;
$array['fax_tasks'][0]['task_reply_address'] = $reply_address;
$array['fax_tasks'][0]['task_description'] = $description;
$p = new permissions;
$p->add('fax_task_add', 'temp');
$database = new database;
$database->app_name = 'fax';
$database->app_uuid = '24108154-4ac3-1db6-1551-4731703a4440';
$database->save($array);
$message = $database->message;
unset($array);
$p->delete('fax_task_add', 'temp');
if ($message['message'] == 'OK' && $message['code'] == 200) {
$response = 'Enqueued';
}
else {
$response = 'Fail Enqueue';
echo $message['message'].' ['.$message['code']."]<br />\n";
if (is_array($message['error']) && @sizeof($message['error']) != 0) {
foreach ($message['error'] as $error) {
echo "<pre>".$error."</pre><br /><br />\n";
}
}
}
return $response;
}
}
if (!function_exists('fax_split_dtmf')) {
function fax_split_dtmf(&$fax_number, &$fax_dtmf){
$tmp = array();
@@ -251,18 +183,19 @@ if (!function_exists('fax_split_dtmf')) {
$continue = false;
if (!$included) {
if (($_POST['action'] == "send")) {
$fax_numbers = $_POST['fax_numbers'];
$fax_uuid = $_POST["id"];
$fax_caller_id_name = $_POST['fax_caller_id_name'];
$fax_caller_id_number = $_POST['fax_caller_id_number'];
$fax_header = $_POST['fax_header'];
$fax_sender = $_POST['fax_sender'];
$fax_recipient = $_POST['fax_recipient'];
$fax_subject = $_POST['fax_subject'];
$fax_message = $_POST['fax_message'];
$fax_resolution = $_POST['fax_resolution'];
$fax_page_size = $_POST['fax_page_size'];
$fax_footer = $_POST['fax_footer'];
//Get values from the HTTP POST to set as variables
$fax_numbers = $_POST['fax_numbers'];
$fax_uuid = $_POST["id"];
$fax_caller_id_name = $_POST['fax_caller_id_name'];
$fax_caller_id_number = $_POST['fax_caller_id_number'];
$fax_header = $_POST['fax_header'];
$fax_sender = $_POST['fax_sender'];
$fax_recipient = $_POST['fax_recipient'];
$fax_subject = $_POST['fax_subject'];
$fax_message = $_POST['fax_message'];
$fax_resolution = $_POST['fax_resolution'];
$fax_page_size = $_POST['fax_page_size'];
$fax_footer = $_POST['fax_footer'];
//validate the token
$token = new token;
@@ -577,20 +510,20 @@ if (!function_exists('fax_split_dtmf')) {
$pages = $pdf->getNumPages();
if ($pages > 1) {
# save ynew for last page
//save ynew for last page
$yn = $pdf->GetY();
# First page
//first page
$pdf->setPage(1, 0);
$pdf->Rect($x + 0.5, $y + 3.4, 7.5, $page_height - 3.9, 'D');
# 2nd to N-th page
//2nd to n-th page
for ($n = 2; $n < $pages; $n++) {
$pdf->setPage($n, 0);
$pdf->Rect($x + 0.5, $y + 0.5, 7.5, $page_height - 1, 'D');
}
#Last page
//last page
$pdf->setPage($pages, 0);
$pdf->Rect($x + 0.5, 0.5, 7.5, $yn, 'D');
$y = $yn;
@@ -612,7 +545,7 @@ if (!function_exists('fax_split_dtmf')) {
$pdf->SetAutoPageBreak(false);
$pdf->SetTopMargin(0);
// save cover pdf
//save cover pdf
$pdf->Output($dir_fax_temp.'/'.$fax_instance_uuid.'_cover.pdf', "F"); // Display [I]nline, Save to [F]ile, [D]ownload
//convert pdf to tif, add to array of pages, delete pdf
@@ -727,16 +660,17 @@ if (!function_exists('fax_split_dtmf')) {
//send the fax
$fax_file = $dir_fax_temp."/".$fax_instance_uuid.".tif";
$tmp_dial_string = "for_fax=1,";
$tmp_dial_string .= "accountcode='" . $fax_accountcode . "',";
$tmp_dial_string .= "sip_h_X-accountcode='" . $fax_accountcode . "',";
$tmp_dial_string .= "domain_uuid=" . $_SESSION["domain_uuid"] . ",";
$tmp_dial_string .= "domain_name=" . $_SESSION["domain_name"] . ",";
$tmp_dial_string .= "origination_caller_id_name='" . $fax_caller_id_name . "',";
$tmp_dial_string .= "origination_caller_id_number='" . $fax_caller_id_number . "',";
$tmp_dial_string .= "fax_ident='" . $fax_caller_id_number . "',";
$tmp_dial_string .= "fax_header='" . $fax_caller_id_name . "',";
$tmp_dial_string .= "fax_file='" . $fax_file . "',";
$common_variables = "for_fax=1,";
$common_variables .= "accountcode='" . $fax_accountcode . "',";
$common_variables .= "sip_h_X-accountcode='" . $fax_accountcode . "',";
$common_variables .= "domain_uuid=" . $_SESSION["domain_uuid"] . ",";
$common_variables .= "domain_name=" . $_SESSION["domain_name"] . ",";
$common_variables .= "origination_caller_id_name='" . $fax_caller_id_name . "',";
$common_variables .= "origination_caller_id_number='" . $fax_caller_id_number . "',";
$common_variables .= "fax_ident='" . $fax_caller_id_number . "',";
$common_variables .= "fax_header='" . $fax_caller_id_name . "',";
$common_variables .= "fax_file='" . $fax_file . "',";
foreach ($fax_numbers as $fax_number) {
$fax_number = trim($fax_number);
@@ -761,40 +695,67 @@ if (!function_exists('fax_split_dtmf')) {
}
}
if ($fax_send_mode != 'queue') {
$dial_string = $tmp_dial_string;
$dial_string .= $fax_variables;
$dial_string .= "mailto_address='" . $mailto_address . "',";
$dial_string .= "mailfrom_address='" . $mailfrom_address . "',";
$dial_string .= "fax_uri=" . $fax_uri . ",";
$dial_string .= "fax_retry_attempts=1" . ",";
$dial_string .= "fax_retry_limit=20" . ",";
$dial_string .= "fax_retry_sleep=180" . ",";
$dial_string .= "fax_verbose=true" . ",";
$dial_string .= "fax_use_ecm=off" . ",";
$dial_string .= "api_hangup_hook='lua fax_retry.lua'";
$dial_string = "{" . $dial_string . "}" . $fax_uri." &txfax('".$fax_file."')";
//build the fax dial string
$dial_string = $common_variables;
$dial_string .= $fax_variables;
$dial_string .= "mailto_address='" . $mailto_address . "',";
$dial_string .= "mailfrom_address='" . $mailfrom_address . "',";
$dial_string .= "fax_uri=" . $fax_uri . ",";
$dial_string .= "fax_retry_attempts=1" . ",";
$dial_string .= "fax_retry_limit=20" . ",";
$dial_string .= "fax_retry_sleep=180" . ",";
$dial_string .= "fax_verbose=true" . ",";
$dial_string .= "fax_use_ecm=off" . ",";
$dial_string .= "api_hangup_hook='lua fax_retry.lua'";
$dial_string = "{" . $dial_string . "}" . $fax_uri." &txfax('".$fax_file."')";
//add fax to the fax queue or send it directly
if (isset($_SESSION['fax']['send_mode']['text']) && $_SESSION['fax']['send_mode']['text'] == 'queue') {
//build an array to add the fax to the queue
$fax_queue_uuid = uuid();
$array['fax_queue'][0]['fax_queue_uuid'] = $fax_queue_uuid;
$array['fax_queue'][0]['domain_uuid'] = $_SESSION['domain_uuid'];
$array['fax_queue'][0]['fax_uuid'] = $fax_uuid;
$array['fax_queue'][0]['fax_date'] = 'now()';
$array['fax_queue'][0]['hostname'] = gethostname();
$array['fax_queue'][0]['fax_caller_id_name'] = $fax_caller_id_name;
$array['fax_queue'][0]['fax_caller_id_number'] = $fax_caller_id_number;
$array['fax_queue'][0]['fax_number'] = $fax_number;
$array['fax_queue'][0]['fax_prefix'] = $fax_prefix;
$array['fax_queue'][0]['fax_email_address'] = $mailto_address;
$array['fax_queue'][0]['fax_file'] = $fax_file;
$array['fax_queue'][0]['fax_status'] = 'waiting';
//$array['fax_queue'][0]['fax_retry_date'] = $fax_retry_date;
$array['fax_queue'][0]['fax_retry_count'] = 0;
$array['fax_queue'][0]['fax_accountcode'] = $fax_accountcode;
$array['fax_queue'][0]['fax_command'] = 'originate '.$dial_string;
//add temporary permisison
$p = new permissions;
$p->add('fax_queue_add', 'temp');
//save the data
$database = new database;
$database->app_name = 'fax queue';
$database->app_uuid = '3656287f-4b22-4cf1-91f6-00386bf488f4';
$database->save($array);
//remove temporary permisison
$p->delete('fax_queue_add', 'temp');
}
else {
//send the fax directly
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
if ($fp) {
$cmd = "api originate " . $dial_string;
//send the command to event socket
$response = event_socket_request($fp, $cmd);
$response = str_replace("\n", "", $response);
$uuid = str_replace("+OK ", "", $response);
}
fclose($fp);
}
else { // enqueue
$wav_file = ''; //! @todo add custom message
$dial_string = $tmp_dial_string;
$response = fax_enqueue($fax_uuid, $fax_file, $wav_file, $mailto_address, $fax_uri, $fax_dtmf, $dial_string);
}
}
//wait for a few seconds
sleep(5);
//move the generated tif (and pdf) files to the sent directory
if (file_exists($dir_fax_temp.'/'.$fax_instance_uuid.".tif")) {
copy($dir_fax_temp.'/'.$fax_instance_uuid.".tif", $dir_fax_sent.'/'.$fax_instance_uuid.".tif");
@@ -804,11 +765,11 @@ if (!function_exists('fax_split_dtmf')) {
copy($dir_fax_temp.'/'.$fax_instance_uuid.".pdf ", $dir_fax_sent.'/'.$fax_instance_uuid.".pdf");
}
//redirect the browser
if (!$included && is_uuid($fax_uuid)) {
//redirect the browser
message::add($response, 'default');
if (isset($_SESSION['fax']['send_mode']['text']) && $_SESSION['fax']['send_mode']['text'] == 'queue') {
header("Location: fax_active.php?id=".$fax_uuid);
header("Location: ".PROJECT_PATH."/app/fax_queue/fax_queue.php?id=".$fax_uuid);
}
else {
header("Location: fax_files.php?id=".$fax_uuid."&box=sent");
@@ -822,6 +783,84 @@ if (!function_exists('fax_split_dtmf')) {
if (!$included) {
//retrieve current user's assigned groups (uuids)
foreach ($_SESSION['groups'] as $group_data) {
$user_group_uuids[] = $group_data['group_uuid'];
}
//add user's uuid to group uuid list to include private (non-shared) contacts
$user_group_uuids[] = $_SESSION["user_uuid"];
$sql = "select ";
$sql .= "c.contact_organization, ";
$sql .= "c.contact_name_given, ";
$sql .= "c.contact_name_family, ";
$sql .= "c.contact_nickname, ";
$sql .= "cp.phone_number ";
$sql .= "from ";
$sql .= "v_contacts as c, ";
$sql .= "v_contact_phones as cp ";
$sql .= "where ";
$sql .= "c.contact_uuid = cp.contact_uuid ";
$sql .= "and c.domain_uuid = :domain_uuid ";
$sql .= "and cp.domain_uuid = :domain_uuid ";
$sql .= "and cp.phone_type_fax = 1 ";
$sql .= "and cp.phone_number is not null ";
$sql .= "and cp.phone_number <> '' ";
if ($_SESSION['contact']['permissions']['boolean'] == "true") {
if (is_array($user_group_uuids) && @sizeof($user_group_uuids) != 0) {
//only show contacts assigned to current user's group(s) and those not assigned to any group
$sql .= "and (";
$sql .= " c.contact_uuid in ( ";
$sql .= " select contact_uuid from v_contact_groups ";
$sql .= " where (";
foreach ($user_group_uuids as $index => $user_group_uuid) {
$sql .= $or;
$sql .= " group_uuid = :group_uuid_".$index." ";
$parameters['group_uuid_'.$index] = $user_group_uuid;
$or = " or ";
}
unset($user_group_uuids, $index, $user_group_uuid, $or);
$sql .= " ) ";
$sql .= " and domain_uuid = :domain_uuid ";
$sql .= " ) ";
$sql .= " or ";
$sql .= " c.contact_uuid not in ( ";
$sql .= " select contact_uuid from v_contact_groups ";
$sql .= " where domain_uuid = :domain_uuid ";
$sql .= " ) ";
$sql .= ") ";
}
}
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
$database = new database;
$contacts = $database->select($sql, $parameters, 'all');
unset($sql, $parameters, $row);
//build the contact labels
if (is_array($contacts) && @sizeof($contacts) != 0) {
foreach ($contacts as &$row) {
if ($row['contact_organization'] != '') {
$contact_option_label = $row['contact_organization'];
}
if ($row['contact_name_given'] != '' || $row['contact_name_family'] != '' || $row['contact_nickname'] != '') {
$contact_option_label .= ($row['contact_organization'] != '') ? "," : null;
$contact_option_label .= ($row['contact_name_given'] != '') ? (($row['contact_organization'] != '') ? " " : null).$row['contact_name_given'] : null;
$contact_option_label .= ($row['contact_name_family'] != '') ? (($row['contact_organization'] != '' || $row['contact_name_given'] != '') ? " " : null).$row['contact_name_family'] : null;
$contact_option_label .= ($row['contact_nickname'] != '') ? (($row['contact_organization'] != '' || $row['contact_name_given'] != '' || $row['contact_name_family'] != '') ? " (".$row['contact_nickname'].")" : $row['contact_nickname']) : null;
}
$contact_option_value_recipient = $contact_option_label;
$contact_option_value_faxnumber = $row['phone_number'];
$contact_option_label .= " ".escape(format_phone($row['phone_number']));
$contact_labels[] = $contact_option_label;
$contact_values[] = $contact_option_value_faxnumber."|".$contact_option_value_recipient;
unset($contact_option_label);
}
if (is_array($contact_labels)) {
//sort by name(s)
asort($contact_labels, SORT_NATURAL);
}
}
//create token
$object = new token;
$token = $object->create($_SERVER['PHP_SELF']);
@@ -921,85 +960,16 @@ if (!$included) {
echo " ".$text['label-fax-recipient']."\n";
echo "</td>\n";
echo "<td class='vtable' align='left'>\n";
//retrieve current user's assigned groups (uuids)
foreach ($_SESSION['groups'] as $group_data) {
$user_group_uuids[] = $group_data['group_uuid'];
}
//add user's uuid to group uuid list to include private (non-shared) contacts
$user_group_uuids[] = $_SESSION["user_uuid"];
$sql = "select ";
$sql .= "c.contact_organization, ";
$sql .= "c.contact_name_given, ";
$sql .= "c.contact_name_family, ";
$sql .= "c.contact_nickname, ";
$sql .= "cp.phone_number ";
$sql .= "from ";
$sql .= "v_contacts as c, ";
$sql .= "v_contact_phones as cp ";
$sql .= "where ";
$sql .= "c.contact_uuid = cp.contact_uuid ";
$sql .= "and c.domain_uuid = :domain_uuid ";
$sql .= "and cp.domain_uuid = :domain_uuid ";
$sql .= "and cp.phone_type_fax = 1 ";
$sql .= "and cp.phone_number is not null ";
$sql .= "and cp.phone_number <> '' ";
if ($_SESSION['contact']['permissions']['boolean'] == "true") {
if (is_array($user_group_uuids) && @sizeof($user_group_uuids) != 0) {
//only show contacts assigned to current user's group(s) and those not assigned to any group
$sql .= "and (";
$sql .= " c.contact_uuid in ( ";
$sql .= " select contact_uuid from v_contact_groups ";
$sql .= " where (";
foreach ($user_group_uuids as $index => $user_group_uuid) {
$sql .= $or;
$sql .= " group_uuid = :group_uuid_".$index." ";
$parameters['group_uuid_'.$index] = $user_group_uuid;
$or = " or ";
}
unset($user_group_uuids, $index, $user_group_uuid, $or);
$sql .= " ) ";
$sql .= " and domain_uuid = :domain_uuid ";
$sql .= " ) ";
$sql .= " or ";
$sql .= " c.contact_uuid not in ( ";
$sql .= " select contact_uuid from v_contact_groups ";
$sql .= " where domain_uuid = :domain_uuid ";
$sql .= " ) ";
$sql .= ") ";
}
}
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
$database = new database;
$contacts = $database->select($sql, $parameters, 'all');
if (is_array($contacts) && @sizeof($contacts) != 0) {
foreach ($contacts as &$row) {
if ($row['contact_organization'] != '') {
$contact_option_label = $row['contact_organization'];
}
if ($row['contact_name_given'] != '' || $row['contact_name_family'] != '' || $row['contact_nickname'] != '') {
$contact_option_label .= ($row['contact_organization'] != '') ? "," : null;
$contact_option_label .= ($row['contact_name_given'] != '') ? (($row['contact_organization'] != '') ? " " : null).$row['contact_name_given'] : null;
$contact_option_label .= ($row['contact_name_family'] != '') ? (($row['contact_organization'] != '' || $row['contact_name_given'] != '') ? " " : null).$row['contact_name_family'] : null;
$contact_option_label .= ($row['contact_nickname'] != '') ? (($row['contact_organization'] != '' || $row['contact_name_given'] != '' || $row['contact_name_family'] != '') ? " (".$row['contact_nickname'].")" : $row['contact_nickname']) : null;
}
$contact_option_value_recipient = $contact_option_label;
$contact_option_value_faxnumber = $row['phone_number'];
$contact_option_label .= ":&nbsp;&nbsp;".escape(format_phone($row['phone_number']));
$contact_labels[] = $contact_option_label;
$contact_values[] = $contact_option_value_faxnumber."|".$contact_option_value_recipient;
unset($contact_option_label);
}
if (is_array($contact_labels)) {
asort($contact_labels, SORT_NATURAL); // sort by name(s)
}
echo " <select class='formfld' style='display: none;' id='fax_recipient_select' onchange='contact_load(this);'>\n";
echo " <option value=''></option>\n";
foreach ($contact_labels as $index => $contact_label) {
echo " <option value=\"".escape($contact_values[$index])."\">".$contact_label."</option>\n";
if (is_array($contact_labels) && @sizeof($contact_labels) != 0) {
foreach ($contact_labels as $index => $contact_label) {
echo " <option value=\"".escape($contact_values[$index])."\">".$contact_label."</option>\n";
}
}
echo " </select>\n";
}
unset($sql, $parameters, $row);
echo " <input type='text' name='fax_recipient' id='fax_recipient' class='formfld' style='max-width: 250px;' value=''>\n";
if (is_array($contacts)) {
echo " <input type='button' id='btn_toggle_recipient' class='btn' name='' alt='".$text['button-back']."' value='&#9665;' onclick=\"toggle('fax_recipient');\">\n";

View File

@@ -0,0 +1,166 @@
<?php
//application details
$apps[$x]['name'] = 'FAX Queue';
$apps[$x]['uuid'] = '3656287f-4b22-4cf1-91f6-00386bf488f4';
$apps[$x]['category'] = '';
$apps[$x]['subcategory'] = '';
$apps[$x]['version'] = '';
$apps[$x]['license'] = 'Mozilla Public License 1.1';
$apps[$x]['url'] = 'http://www.fusionpbx.com';
$apps[$x]['description']['en-us'] = '';
//permission details
$y = 0;
$apps[$x]['permissions'][$y]['name'] = 'fax_queue_view';
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
//$apps[$x]['permissions'][$y]['groups'][] = 'admin';
$y++;
$apps[$x]['permissions'][$y]['name'] = 'fax_queue_add';
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
//$apps[$x]['permissions'][$y]['groups'][] = 'admin';
$y++;
$apps[$x]['permissions'][$y]['name'] = 'fax_queue_edit';
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
//$apps[$x]['permissions'][$y]['groups'][] = 'admin';
$y++;
$apps[$x]['permissions'][$y]['name'] = 'fax_queue_delete';
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
//$apps[$x]['permissions'][$y]['groups'][] = 'admin';
$y++;
$apps[$x]['permissions'][$y]['name'] = 'fax_queue_all';
$apps[$x]['permissions'][$y]['groups'][] = 'superadmin';
$y++;
//default settings
$y=0;
$apps[$x]['default_settings'][$y]['default_setting_uuid'] = "84a6f2a8-4633-49d9-ad28-c9f96d630050";
$apps[$x]['default_settings'][$y]['default_setting_category'] = "fax_queue";
$apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "limit";
$apps[$x]['default_settings'][$y]['default_setting_name'] = "numeric";
$apps[$x]['default_settings'][$y]['default_setting_value'] = "30";
$apps[$x]['default_settings'][$y]['default_setting_enabled'] = "true";
$apps[$x]['default_settings'][$y]['default_setting_description'] = "Limit the records to process at one time.";
$y++;
$apps[$x]['default_settings'][$y]['default_setting_uuid'] = "4d05c680-6ef8-422a-a26f-845ec0135729";
$apps[$x]['default_settings'][$y]['default_setting_category'] = "fax_queue";
$apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "retry_limit";
$apps[$x]['default_settings'][$y]['default_setting_name'] = "numeric";
$apps[$x]['default_settings'][$y]['default_setting_value'] = "3";
$apps[$x]['default_settings'][$y]['default_setting_enabled'] = "true";
$apps[$x]['default_settings'][$y]['default_setting_description'] = "Number of tries to send before giving up.";
$y++;
$apps[$x]['default_settings'][$y]['default_setting_uuid'] = "9c379e94-0cb8-41d6-8ee5-8459c5ef7391";
$apps[$x]['default_settings'][$y]['default_setting_category'] = "fax_queue";
$apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "interval";
$apps[$x]['default_settings'][$y]['default_setting_name'] = "numeric";
$apps[$x]['default_settings'][$y]['default_setting_value'] = "180";
$apps[$x]['default_settings'][$y]['default_setting_enabled'] = "true";
$apps[$x]['default_settings'][$y]['default_setting_description'] = "How often to process the queue. Default 180 seconds.";
//$y++;
//$apps[$x]['default_settings'][$y]['default_setting_uuid'] = "afd729d9-cf69-4793-a140-21093814d314";
//$apps[$x]['default_settings'][$y]['default_setting_category'] = "fax_queue";
//$apps[$x]['default_settings'][$y]['default_setting_subcategory'] = "enabled";
//$apps[$x]['default_settings'][$y]['default_setting_name'] = "boolean";
//$apps[$x]['default_settings'][$y]['default_setting_value'] = "true";
//$apps[$x]['default_settings'][$y]['default_setting_enabled'] = "true";
//$apps[$x]['default_settings'][$y]['default_setting_description'] = "Enable or disable the fax queue.";
//$y++;
//fax queue
$y = 0;
$apps[$x]['db'][$y]['table']['name'] = 'v_fax_queue';
$apps[$x]['db'][$y]['table']['parent'] = '';
$z = 0;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'fax_queue_uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'primary';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'domain_uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
$apps[$x]['db'][$y]['fields'][$z]['key']['type'] = 'foreign';
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['table'] = 'v_domains';
$apps[$x]['db'][$y]['fields'][$z]['key']['reference']['field'] = 'domain_uuid';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'fax_uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'uuid';
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'char(36)';
$apps[$x]['db'][$y]['fields'][$z]['search_by'] = '';
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = '';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'fax_date';
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'timestamptz';
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'date';
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'date';
$apps[$x]['db'][$y]['fields'][$z]['search_by'] = '';
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Date of the FAX entered the queue.';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'hostname';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['search_by'] = '1';
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Hostname of the server.';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'fax_caller_id_name';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['search_by'] = '1';
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Enter the Caller ID name.';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'fax_caller_id_number';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['search_by'] = '1';
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Enter the Caller ID number.';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'fax_number';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['search_by'] = '1';
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Enter the fax destination.';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'fax_prefix';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['search_by'] = '';
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Enter the fax prefix.';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'fax_email_address';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['search_by'] = '1';
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Enter the fax email address.';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'fax_file';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['search_by'] = '1';
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Enter the fax file.';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'fax_status';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['search_by'] = '1';
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Enter the fax status.';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'fax_retry_date';
$apps[$x]['db'][$y]['fields'][$z]['type']['pgsql'] = 'timestamptz';
$apps[$x]['db'][$y]['fields'][$z]['type']['sqlite'] = 'date';
$apps[$x]['db'][$y]['fields'][$z]['type']['mysql'] = 'date';
$apps[$x]['db'][$y]['fields'][$z]['search_by'] = '1';
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Date the fax was retried';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'fax_retry_count';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'numeric';
$apps[$x]['db'][$y]['fields'][$z]['search_by'] = '';
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Enter the fax retries.';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'fax_accountcode';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['search_by'] = '1';
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Enter the accountcode.';
$z++;
$apps[$x]['db'][$y]['fields'][$z]['name'] = 'fax_command';
$apps[$x]['db'][$y]['fields'][$z]['type'] = 'text';
$apps[$x]['db'][$y]['fields'][$z]['search_by'] = '1';
$apps[$x]['db'][$y]['fields'][$z]['description']['en-us'] = 'Enter the fax command.';
$z++;
?>

View File

@@ -0,0 +1,7 @@
<?php
if ($domains_processed == 1) {
}
?>

View File

@@ -0,0 +1,624 @@
<?php
//FAX Queue
$text['title-fax_queue']['en-us'] = 'FAX Queue';
$text['title-fax_queue']['ar-eg'] = '';
$text['title-fax_queue']['de-at'] = '';
$text['title-fax_queue']['de-ch'] = '';
$text['title-fax_queue']['de-de'] = '';
$text['title-fax_queue']['es-cl'] = '';
$text['title-fax_queue']['es-mx'] = '';
$text['title-fax_queue']['fr-ca'] = '';
$text['title-fax_queue']['fr-fr'] = '';
$text['title-fax_queue']['he-il'] = '';
$text['title-fax_queue']['it-it'] = '';
$text['title-fax_queue']['nl-nl'] = '';
$text['title-fax_queue']['pl-pl'] = '';
$text['title-fax_queue']['pt-br'] = '';
$text['title-fax_queue']['pt-pt'] = '';
$text['title-fax_queue']['ro-ro'] = '';
$text['title-fax_queue']['ru-ru'] = '';
$text['title-fax_queue']['sv-se'] = '';
$text['title-fax_queue']['uk-ua'] = '';
$text['title-fax_queue']['en-us'] = 'FAX Queue';
$text['title-fax_queue']['ar-eg'] = '';
$text['title-fax_queue']['de-at'] = '';
$text['title-fax_queue']['de-ch'] = '';
$text['title-fax_queue']['de-de'] = '';
$text['title-fax_queue']['es-cl'] = '';
$text['title-fax_queue']['es-mx'] = '';
$text['title-fax_queue']['fr-ca'] = '';
$text['title-fax_queue']['fr-fr'] = '';
$text['title-fax_queue']['he-il'] = '';
$text['title-fax_queue']['it-it'] = '';
$text['title-fax_queue']['nl-nl'] = '';
$text['title-fax_queue']['pl-pl'] = '';
$text['title-fax_queue']['pt-br'] = '';
$text['title-fax_queue']['pt-pt'] = '';
$text['title-fax_queue']['ro-ro'] = '';
$text['title-fax_queue']['ru-ru'] = '';
$text['title-fax_queue']['sv-se'] = '';
$text['title-fax_queue']['uk-ua'] = '';
$text['title_description-fax_queue']['en-us'] = '';
$text['title_description-fax_queue']['ar-eg'] = '';
$text['title_description-fax_queue']['de-at'] = '';
$text['title_description-fax_queue']['de-ch'] = '';
$text['title_description-fax_queue']['de-de'] = '';
$text['title_description-fax_queue']['es-cl'] = '';
$text['title_description-fax_queue']['es-mx'] = '';
$text['title_description-fax_queue']['fr-ca'] = '';
$text['title_description-fax_queue']['fr-fr'] = '';
$text['title_description-fax_queue']['he-il'] = '';
$text['title_description-fax_queue']['it-it'] = '';
$text['title_description-fax_queue']['nl-nl'] = '';
$text['title_description-fax_queue']['pl-pl'] = '';
$text['title_description-fax_queue']['pt-br'] = '';
$text['title_description-fax_queue']['pt-pt'] = '';
$text['title_description-fax_queue']['ro-ro'] = '';
$text['title_description-fax_queue']['ru-ru'] = '';
$text['title_description-fax_queue']['sv-se'] = '';
$text['title_description-fax_queue']['uk-ua'] = '';
$text['label-fax_uuid']['en-us'] = 'FAX ID';
$text['label-fax_uuid']['ar-eg'] = '';
$text['label-fax_uuid']['de-at'] = '';
$text['label-fax_uuid']['de-ch'] = '';
$text['label-fax_uuid']['de-de'] = '';
$text['label-fax_uuid']['es-cl'] = '';
$text['label-fax_uuid']['es-mx'] = '';
$text['label-fax_uuid']['fr-ca'] = '';
$text['label-fax_uuid']['fr-fr'] = '';
$text['label-fax_uuid']['he-il'] = '';
$text['label-fax_uuid']['it-it'] = '';
$text['label-fax_uuid']['nl-nl'] = '';
$text['label-fax_uuid']['pl-pl'] = '';
$text['label-fax_uuid']['pt-br'] = '';
$text['label-fax_uuid']['pt-pt'] = '';
$text['label-fax_uuid']['ro-ro'] = '';
$text['label-fax_uuid']['ru-ru'] = '';
$text['label-fax_uuid']['sv-se'] = '';
$text['label-fax_uuid']['uk-ua'] = '';
$text['description-fax_uuid']['en-us'] = '';
$text['description-fax_uuid']['ar-eg'] = '';
$text['description-fax_uuid']['de-at'] = '';
$text['description-fax_uuid']['de-ch'] = '';
$text['description-fax_uuid']['de-de'] = '';
$text['description-fax_uuid']['es-cl'] = '';
$text['description-fax_uuid']['es-mx'] = '';
$text['description-fax_uuid']['fr-ca'] = '';
$text['description-fax_uuid']['fr-fr'] = '';
$text['description-fax_uuid']['he-il'] = '';
$text['description-fax_uuid']['it-it'] = '';
$text['description-fax_uuid']['nl-nl'] = '';
$text['description-fax_uuid']['pl-pl'] = '';
$text['description-fax_uuid']['pt-br'] = '';
$text['description-fax_uuid']['pt-pt'] = '';
$text['description-fax_uuid']['ro-ro'] = '';
$text['description-fax_uuid']['ru-ru'] = '';
$text['description-fax_uuid']['sv-se'] = '';
$text['description-fax_uuid']['uk-ua'] = '';
$text['label-fax_date']['en-us'] = 'Date';
$text['label-fax_date']['ar-eg'] = '';
$text['label-fax_date']['de-at'] = '';
$text['label-fax_date']['de-ch'] = '';
$text['label-fax_date']['de-de'] = '';
$text['label-fax_date']['es-cl'] = '';
$text['label-fax_date']['es-mx'] = '';
$text['label-fax_date']['fr-ca'] = '';
$text['label-fax_date']['fr-fr'] = '';
$text['label-fax_date']['he-il'] = '';
$text['label-fax_date']['it-it'] = '';
$text['label-fax_date']['nl-nl'] = '';
$text['label-fax_date']['pl-pl'] = '';
$text['label-fax_date']['pt-br'] = '';
$text['label-fax_date']['pt-pt'] = '';
$text['label-fax_date']['ro-ro'] = '';
$text['label-fax_date']['ru-ru'] = '';
$text['label-fax_date']['sv-se'] = '';
$text['label-fax_date']['uk-ua'] = '';
$text['description-fax_date']['en-us'] = 'Date of the FAX entered the queue.';
$text['description-fax_date']['ar-eg'] = '';
$text['description-fax_date']['de-at'] = '';
$text['description-fax_date']['de-ch'] = '';
$text['description-fax_date']['de-de'] = '';
$text['description-fax_date']['es-cl'] = '';
$text['description-fax_date']['es-mx'] = '';
$text['description-fax_date']['fr-ca'] = '';
$text['description-fax_date']['fr-fr'] = '';
$text['description-fax_date']['he-il'] = '';
$text['description-fax_date']['it-it'] = '';
$text['description-fax_date']['nl-nl'] = '';
$text['description-fax_date']['pl-pl'] = '';
$text['description-fax_date']['pt-br'] = '';
$text['description-fax_date']['pt-pt'] = '';
$text['description-fax_date']['ro-ro'] = '';
$text['description-fax_date']['ru-ru'] = '';
$text['description-fax_date']['sv-se'] = '';
$text['description-fax_date']['uk-ua'] = '';
$text['label-hostname']['en-us'] = 'Hostname';
$text['label-hostname']['ar-eg'] = '';
$text['label-hostname']['de-at'] = '';
$text['label-hostname']['de-ch'] = '';
$text['label-hostname']['de-de'] = '';
$text['label-hostname']['es-cl'] = '';
$text['label-hostname']['es-mx'] = '';
$text['label-hostname']['fr-ca'] = '';
$text['label-hostname']['fr-fr'] = '';
$text['label-hostname']['he-il'] = '';
$text['label-hostname']['it-it'] = '';
$text['label-hostname']['nl-nl'] = '';
$text['label-hostname']['pl-pl'] = '';
$text['label-hostname']['pt-br'] = '';
$text['label-hostname']['pt-pt'] = '';
$text['label-hostname']['ro-ro'] = '';
$text['label-hostname']['ru-ru'] = '';
$text['label-hostname']['sv-se'] = '';
$text['label-hostname']['uk-ua'] = '';
$text['description-hostname']['en-us'] = 'Hostname of the server.';
$text['description-hostname']['ar-eg'] = '';
$text['description-hostname']['de-at'] = '';
$text['description-hostname']['de-ch'] = '';
$text['description-hostname']['de-de'] = '';
$text['description-hostname']['es-cl'] = '';
$text['description-hostname']['es-mx'] = '';
$text['description-hostname']['fr-ca'] = '';
$text['description-hostname']['fr-fr'] = '';
$text['description-hostname']['he-il'] = '';
$text['description-hostname']['it-it'] = '';
$text['description-hostname']['nl-nl'] = '';
$text['description-hostname']['pl-pl'] = '';
$text['description-hostname']['pt-br'] = '';
$text['description-hostname']['pt-pt'] = '';
$text['description-hostname']['ro-ro'] = '';
$text['description-hostname']['ru-ru'] = '';
$text['description-hostname']['sv-se'] = '';
$text['description-hostname']['uk-ua'] = '';
$text['label-fax_caller_id_name']['en-us'] = 'Caller ID Name';
$text['label-fax_caller_id_name']['ar-eg'] = '';
$text['label-fax_caller_id_name']['de-at'] = '';
$text['label-fax_caller_id_name']['de-ch'] = '';
$text['label-fax_caller_id_name']['de-de'] = '';
$text['label-fax_caller_id_name']['es-cl'] = '';
$text['label-fax_caller_id_name']['es-mx'] = '';
$text['label-fax_caller_id_name']['fr-ca'] = '';
$text['label-fax_caller_id_name']['fr-fr'] = '';
$text['label-fax_caller_id_name']['he-il'] = '';
$text['label-fax_caller_id_name']['it-it'] = '';
$text['label-fax_caller_id_name']['nl-nl'] = '';
$text['label-fax_caller_id_name']['pl-pl'] = '';
$text['label-fax_caller_id_name']['pt-br'] = '';
$text['label-fax_caller_id_name']['pt-pt'] = '';
$text['label-fax_caller_id_name']['ro-ro'] = '';
$text['label-fax_caller_id_name']['ru-ru'] = '';
$text['label-fax_caller_id_name']['sv-se'] = '';
$text['label-fax_caller_id_name']['uk-ua'] = '';
$text['description-fax_caller_id_name']['en-us'] = 'Enter the Caller ID name.';
$text['description-fax_caller_id_name']['ar-eg'] = '';
$text['description-fax_caller_id_name']['de-at'] = '';
$text['description-fax_caller_id_name']['de-ch'] = '';
$text['description-fax_caller_id_name']['de-de'] = '';
$text['description-fax_caller_id_name']['es-cl'] = '';
$text['description-fax_caller_id_name']['es-mx'] = '';
$text['description-fax_caller_id_name']['fr-ca'] = '';
$text['description-fax_caller_id_name']['fr-fr'] = '';
$text['description-fax_caller_id_name']['he-il'] = '';
$text['description-fax_caller_id_name']['it-it'] = '';
$text['description-fax_caller_id_name']['nl-nl'] = '';
$text['description-fax_caller_id_name']['pl-pl'] = '';
$text['description-fax_caller_id_name']['pt-br'] = '';
$text['description-fax_caller_id_name']['pt-pt'] = '';
$text['description-fax_caller_id_name']['ro-ro'] = '';
$text['description-fax_caller_id_name']['ru-ru'] = '';
$text['description-fax_caller_id_name']['sv-se'] = '';
$text['description-fax_caller_id_name']['uk-ua'] = '';
$text['label-fax_caller_id_number']['en-us'] = 'Caller ID Number';
$text['label-fax_caller_id_number']['ar-eg'] = '';
$text['label-fax_caller_id_number']['de-at'] = '';
$text['label-fax_caller_id_number']['de-ch'] = '';
$text['label-fax_caller_id_number']['de-de'] = '';
$text['label-fax_caller_id_number']['es-cl'] = '';
$text['label-fax_caller_id_number']['es-mx'] = '';
$text['label-fax_caller_id_number']['fr-ca'] = '';
$text['label-fax_caller_id_number']['fr-fr'] = '';
$text['label-fax_caller_id_number']['he-il'] = '';
$text['label-fax_caller_id_number']['it-it'] = '';
$text['label-fax_caller_id_number']['nl-nl'] = '';
$text['label-fax_caller_id_number']['pl-pl'] = '';
$text['label-fax_caller_id_number']['pt-br'] = '';
$text['label-fax_caller_id_number']['pt-pt'] = '';
$text['label-fax_caller_id_number']['ro-ro'] = '';
$text['label-fax_caller_id_number']['ru-ru'] = '';
$text['label-fax_caller_id_number']['sv-se'] = '';
$text['label-fax_caller_id_number']['uk-ua'] = '';
$text['description-fax_caller_id_number']['en-us'] = 'Enter the Caller ID number.';
$text['description-fax_caller_id_number']['ar-eg'] = '';
$text['description-fax_caller_id_number']['de-at'] = '';
$text['description-fax_caller_id_number']['de-ch'] = '';
$text['description-fax_caller_id_number']['de-de'] = '';
$text['description-fax_caller_id_number']['es-cl'] = '';
$text['description-fax_caller_id_number']['es-mx'] = '';
$text['description-fax_caller_id_number']['fr-ca'] = '';
$text['description-fax_caller_id_number']['fr-fr'] = '';
$text['description-fax_caller_id_number']['he-il'] = '';
$text['description-fax_caller_id_number']['it-it'] = '';
$text['description-fax_caller_id_number']['nl-nl'] = '';
$text['description-fax_caller_id_number']['pl-pl'] = '';
$text['description-fax_caller_id_number']['pt-br'] = '';
$text['description-fax_caller_id_number']['pt-pt'] = '';
$text['description-fax_caller_id_number']['ro-ro'] = '';
$text['description-fax_caller_id_number']['ru-ru'] = '';
$text['description-fax_caller_id_number']['sv-se'] = '';
$text['description-fax_caller_id_number']['uk-ua'] = '';
$text['label-fax_number']['en-us'] = 'Number';
$text['label-fax_number']['ar-eg'] = '';
$text['label-fax_number']['de-at'] = '';
$text['label-fax_number']['de-ch'] = '';
$text['label-fax_number']['de-de'] = '';
$text['label-fax_number']['es-cl'] = '';
$text['label-fax_number']['es-mx'] = '';
$text['label-fax_number']['fr-ca'] = '';
$text['label-fax_number']['fr-fr'] = '';
$text['label-fax_number']['he-il'] = '';
$text['label-fax_number']['it-it'] = '';
$text['label-fax_number']['nl-nl'] = '';
$text['label-fax_number']['pl-pl'] = '';
$text['label-fax_number']['pt-br'] = '';
$text['label-fax_number']['pt-pt'] = '';
$text['label-fax_number']['ro-ro'] = '';
$text['label-fax_number']['ru-ru'] = '';
$text['label-fax_number']['sv-se'] = '';
$text['label-fax_number']['uk-ua'] = '';
$text['description-fax_number']['en-us'] = 'Enter the fax destination.';
$text['description-fax_number']['ar-eg'] = '';
$text['description-fax_number']['de-at'] = '';
$text['description-fax_number']['de-ch'] = '';
$text['description-fax_number']['de-de'] = '';
$text['description-fax_number']['es-cl'] = '';
$text['description-fax_number']['es-mx'] = '';
$text['description-fax_number']['fr-ca'] = '';
$text['description-fax_number']['fr-fr'] = '';
$text['description-fax_number']['he-il'] = '';
$text['description-fax_number']['it-it'] = '';
$text['description-fax_number']['nl-nl'] = '';
$text['description-fax_number']['pl-pl'] = '';
$text['description-fax_number']['pt-br'] = '';
$text['description-fax_number']['pt-pt'] = '';
$text['description-fax_number']['ro-ro'] = '';
$text['description-fax_number']['ru-ru'] = '';
$text['description-fax_number']['sv-se'] = '';
$text['description-fax_number']['uk-ua'] = '';
$text['label-fax_prefix']['en-us'] = 'Prefix';
$text['label-fax_prefix']['ar-eg'] = '';
$text['label-fax_prefix']['de-at'] = '';
$text['label-fax_prefix']['de-ch'] = '';
$text['label-fax_prefix']['de-de'] = '';
$text['label-fax_prefix']['es-cl'] = '';
$text['label-fax_prefix']['es-mx'] = '';
$text['label-fax_prefix']['fr-ca'] = '';
$text['label-fax_prefix']['fr-fr'] = '';
$text['label-fax_prefix']['he-il'] = '';
$text['label-fax_prefix']['it-it'] = '';
$text['label-fax_prefix']['nl-nl'] = '';
$text['label-fax_prefix']['pl-pl'] = '';
$text['label-fax_prefix']['pt-br'] = '';
$text['label-fax_prefix']['pt-pt'] = '';
$text['label-fax_prefix']['ro-ro'] = '';
$text['label-fax_prefix']['ru-ru'] = '';
$text['label-fax_prefix']['sv-se'] = '';
$text['label-fax_prefix']['uk-ua'] = '';
$text['description-fax_prefix']['en-us'] = 'Enter the fax prefix.';
$text['description-fax_prefix']['ar-eg'] = '';
$text['description-fax_prefix']['de-at'] = '';
$text['description-fax_prefix']['de-ch'] = '';
$text['description-fax_prefix']['de-de'] = '';
$text['description-fax_prefix']['es-cl'] = '';
$text['description-fax_prefix']['es-mx'] = '';
$text['description-fax_prefix']['fr-ca'] = '';
$text['description-fax_prefix']['fr-fr'] = '';
$text['description-fax_prefix']['he-il'] = '';
$text['description-fax_prefix']['it-it'] = '';
$text['description-fax_prefix']['nl-nl'] = '';
$text['description-fax_prefix']['pl-pl'] = '';
$text['description-fax_prefix']['pt-br'] = '';
$text['description-fax_prefix']['pt-pt'] = '';
$text['description-fax_prefix']['ro-ro'] = '';
$text['description-fax_prefix']['ru-ru'] = '';
$text['description-fax_prefix']['sv-se'] = '';
$text['description-fax_prefix']['uk-ua'] = '';
$text['label-fax_email_address']['en-us'] = 'Email Address';
$text['label-fax_email_address']['ar-eg'] = '';
$text['label-fax_email_address']['de-at'] = '';
$text['label-fax_email_address']['de-ch'] = '';
$text['label-fax_email_address']['de-de'] = '';
$text['label-fax_email_address']['es-cl'] = '';
$text['label-fax_email_address']['es-mx'] = '';
$text['label-fax_email_address']['fr-ca'] = '';
$text['label-fax_email_address']['fr-fr'] = '';
$text['label-fax_email_address']['he-il'] = '';
$text['label-fax_email_address']['it-it'] = '';
$text['label-fax_email_address']['nl-nl'] = '';
$text['label-fax_email_address']['pl-pl'] = '';
$text['label-fax_email_address']['pt-br'] = '';
$text['label-fax_email_address']['pt-pt'] = '';
$text['label-fax_email_address']['ro-ro'] = '';
$text['label-fax_email_address']['ru-ru'] = '';
$text['label-fax_email_address']['sv-se'] = '';
$text['label-fax_email_address']['uk-ua'] = '';
$text['description-fax_email_address']['en-us'] = 'Enter the fax email address.';
$text['description-fax_email_address']['ar-eg'] = '';
$text['description-fax_email_address']['de-at'] = '';
$text['description-fax_email_address']['de-ch'] = '';
$text['description-fax_email_address']['de-de'] = '';
$text['description-fax_email_address']['es-cl'] = '';
$text['description-fax_email_address']['es-mx'] = '';
$text['description-fax_email_address']['fr-ca'] = '';
$text['description-fax_email_address']['fr-fr'] = '';
$text['description-fax_email_address']['he-il'] = '';
$text['description-fax_email_address']['it-it'] = '';
$text['description-fax_email_address']['nl-nl'] = '';
$text['description-fax_email_address']['pl-pl'] = '';
$text['description-fax_email_address']['pt-br'] = '';
$text['description-fax_email_address']['pt-pt'] = '';
$text['description-fax_email_address']['ro-ro'] = '';
$text['description-fax_email_address']['ru-ru'] = '';
$text['description-fax_email_address']['sv-se'] = '';
$text['description-fax_email_address']['uk-ua'] = '';
$text['label-fax_file']['en-us'] = 'File';
$text['label-fax_file']['ar-eg'] = '';
$text['label-fax_file']['de-at'] = '';
$text['label-fax_file']['de-ch'] = '';
$text['label-fax_file']['de-de'] = '';
$text['label-fax_file']['es-cl'] = '';
$text['label-fax_file']['es-mx'] = '';
$text['label-fax_file']['fr-ca'] = '';
$text['label-fax_file']['fr-fr'] = '';
$text['label-fax_file']['he-il'] = '';
$text['label-fax_file']['it-it'] = '';
$text['label-fax_file']['nl-nl'] = '';
$text['label-fax_file']['pl-pl'] = '';
$text['label-fax_file']['pt-br'] = '';
$text['label-fax_file']['pt-pt'] = '';
$text['label-fax_file']['ro-ro'] = '';
$text['label-fax_file']['ru-ru'] = '';
$text['label-fax_file']['sv-se'] = '';
$text['label-fax_file']['uk-ua'] = '';
$text['description-fax_file']['en-us'] = 'Enter the fax file.';
$text['description-fax_file']['ar-eg'] = '';
$text['description-fax_file']['de-at'] = '';
$text['description-fax_file']['de-ch'] = '';
$text['description-fax_file']['de-de'] = '';
$text['description-fax_file']['es-cl'] = '';
$text['description-fax_file']['es-mx'] = '';
$text['description-fax_file']['fr-ca'] = '';
$text['description-fax_file']['fr-fr'] = '';
$text['description-fax_file']['he-il'] = '';
$text['description-fax_file']['it-it'] = '';
$text['description-fax_file']['nl-nl'] = '';
$text['description-fax_file']['pl-pl'] = '';
$text['description-fax_file']['pt-br'] = '';
$text['description-fax_file']['pt-pt'] = '';
$text['description-fax_file']['ro-ro'] = '';
$text['description-fax_file']['ru-ru'] = '';
$text['description-fax_file']['sv-se'] = '';
$text['description-fax_file']['uk-ua'] = '';
$text['label-fax_status']['en-us'] = 'Status';
$text['label-fax_status']['ar-eg'] = '';
$text['label-fax_status']['de-at'] = '';
$text['label-fax_status']['de-ch'] = '';
$text['label-fax_status']['de-de'] = '';
$text['label-fax_status']['es-cl'] = '';
$text['label-fax_status']['es-mx'] = '';
$text['label-fax_status']['fr-ca'] = '';
$text['label-fax_status']['fr-fr'] = '';
$text['label-fax_status']['he-il'] = '';
$text['label-fax_status']['it-it'] = '';
$text['label-fax_status']['nl-nl'] = '';
$text['label-fax_status']['pl-pl'] = '';
$text['label-fax_status']['pt-br'] = '';
$text['label-fax_status']['pt-pt'] = '';
$text['label-fax_status']['ro-ro'] = '';
$text['label-fax_status']['ru-ru'] = '';
$text['label-fax_status']['sv-se'] = '';
$text['label-fax_status']['uk-ua'] = '';
$text['description-fax_status']['en-us'] = 'Enter the fax status.';
$text['description-fax_status']['ar-eg'] = '';
$text['description-fax_status']['de-at'] = '';
$text['description-fax_status']['de-ch'] = '';
$text['description-fax_status']['de-de'] = '';
$text['description-fax_status']['es-cl'] = '';
$text['description-fax_status']['es-mx'] = '';
$text['description-fax_status']['fr-ca'] = '';
$text['description-fax_status']['fr-fr'] = '';
$text['description-fax_status']['he-il'] = '';
$text['description-fax_status']['it-it'] = '';
$text['description-fax_status']['nl-nl'] = '';
$text['description-fax_status']['pl-pl'] = '';
$text['description-fax_status']['pt-br'] = '';
$text['description-fax_status']['pt-pt'] = '';
$text['description-fax_status']['ro-ro'] = '';
$text['description-fax_status']['ru-ru'] = '';
$text['description-fax_status']['sv-se'] = '';
$text['description-fax_status']['uk-ua'] = '';
$text['label-fax_retry_date']['en-us'] = 'Retry Date';
$text['label-fax_retry_date']['ar-eg'] = '';
$text['label-fax_retry_date']['de-at'] = '';
$text['label-fax_retry_date']['de-ch'] = '';
$text['label-fax_retry_date']['de-de'] = '';
$text['label-fax_retry_date']['es-cl'] = '';
$text['label-fax_retry_date']['es-mx'] = '';
$text['label-fax_retry_date']['fr-ca'] = '';
$text['label-fax_retry_date']['fr-fr'] = '';
$text['label-fax_retry_date']['he-il'] = '';
$text['label-fax_retry_date']['it-it'] = '';
$text['label-fax_retry_date']['nl-nl'] = '';
$text['label-fax_retry_date']['pl-pl'] = '';
$text['label-fax_retry_date']['pt-br'] = '';
$text['label-fax_retry_date']['pt-pt'] = '';
$text['label-fax_retry_date']['ro-ro'] = '';
$text['label-fax_retry_date']['ru-ru'] = '';
$text['label-fax_retry_date']['sv-se'] = '';
$text['label-fax_retry_date']['uk-ua'] = '';
$text['description-fax_retry_date']['en-us'] = 'Date the fax was retried';
$text['description-fax_retry_date']['ar-eg'] = '';
$text['description-fax_retry_date']['de-at'] = '';
$text['description-fax_retry_date']['de-ch'] = '';
$text['description-fax_retry_date']['de-de'] = '';
$text['description-fax_retry_date']['es-cl'] = '';
$text['description-fax_retry_date']['es-mx'] = '';
$text['description-fax_retry_date']['fr-ca'] = '';
$text['description-fax_retry_date']['fr-fr'] = '';
$text['description-fax_retry_date']['he-il'] = '';
$text['description-fax_retry_date']['it-it'] = '';
$text['description-fax_retry_date']['nl-nl'] = '';
$text['description-fax_retry_date']['pl-pl'] = '';
$text['description-fax_retry_date']['pt-br'] = '';
$text['description-fax_retry_date']['pt-pt'] = '';
$text['description-fax_retry_date']['ro-ro'] = '';
$text['description-fax_retry_date']['ru-ru'] = '';
$text['description-fax_retry_date']['sv-se'] = '';
$text['description-fax_retry_date']['uk-ua'] = '';
$text['label-fax_retry_count']['en-us'] = 'Retry Count';
$text['label-fax_retry_count']['ar-eg'] = '';
$text['label-fax_retry_count']['de-at'] = '';
$text['label-fax_retry_count']['de-ch'] = '';
$text['label-fax_retry_count']['de-de'] = '';
$text['label-fax_retry_count']['es-cl'] = '';
$text['label-fax_retry_count']['es-mx'] = '';
$text['label-fax_retry_count']['fr-ca'] = '';
$text['label-fax_retry_count']['fr-fr'] = '';
$text['label-fax_retry_count']['he-il'] = '';
$text['label-fax_retry_count']['it-it'] = '';
$text['label-fax_retry_count']['nl-nl'] = '';
$text['label-fax_retry_count']['pl-pl'] = '';
$text['label-fax_retry_count']['pt-br'] = '';
$text['label-fax_retry_count']['pt-pt'] = '';
$text['label-fax_retry_count']['ro-ro'] = '';
$text['label-fax_retry_count']['ru-ru'] = '';
$text['label-fax_retry_count']['sv-se'] = '';
$text['label-fax_retry_count']['uk-ua'] = '';
$text['description-fax_retry_count']['en-us'] = 'Enter the fax retries.';
$text['description-fax_retry_count']['ar-eg'] = '';
$text['description-fax_retry_count']['de-at'] = '';
$text['description-fax_retry_count']['de-ch'] = '';
$text['description-fax_retry_count']['de-de'] = '';
$text['description-fax_retry_count']['es-cl'] = '';
$text['description-fax_retry_count']['es-mx'] = '';
$text['description-fax_retry_count']['fr-ca'] = '';
$text['description-fax_retry_count']['fr-fr'] = '';
$text['description-fax_retry_count']['he-il'] = '';
$text['description-fax_retry_count']['it-it'] = '';
$text['description-fax_retry_count']['nl-nl'] = '';
$text['description-fax_retry_count']['pl-pl'] = '';
$text['description-fax_retry_count']['pt-br'] = '';
$text['description-fax_retry_count']['pt-pt'] = '';
$text['description-fax_retry_count']['ro-ro'] = '';
$text['description-fax_retry_count']['ru-ru'] = '';
$text['description-fax_retry_count']['sv-se'] = '';
$text['description-fax_retry_count']['uk-ua'] = '';
$text['label-fax_accountcode']['en-us'] = 'Accountcode';
$text['label-fax_accountcode']['ar-eg'] = '';
$text['label-fax_accountcode']['de-at'] = '';
$text['label-fax_accountcode']['de-ch'] = '';
$text['label-fax_accountcode']['de-de'] = '';
$text['label-fax_accountcode']['es-cl'] = '';
$text['label-fax_accountcode']['es-mx'] = '';
$text['label-fax_accountcode']['fr-ca'] = '';
$text['label-fax_accountcode']['fr-fr'] = '';
$text['label-fax_accountcode']['he-il'] = '';
$text['label-fax_accountcode']['it-it'] = '';
$text['label-fax_accountcode']['nl-nl'] = '';
$text['label-fax_accountcode']['pl-pl'] = '';
$text['label-fax_accountcode']['pt-br'] = '';
$text['label-fax_accountcode']['pt-pt'] = '';
$text['label-fax_accountcode']['ro-ro'] = '';
$text['label-fax_accountcode']['ru-ru'] = '';
$text['label-fax_accountcode']['sv-se'] = '';
$text['label-fax_accountcode']['uk-ua'] = '';
$text['description-fax_accountcode']['en-us'] = 'Enter the accountcode.';
$text['description-fax_accountcode']['ar-eg'] = '';
$text['description-fax_accountcode']['de-at'] = '';
$text['description-fax_accountcode']['de-ch'] = '';
$text['description-fax_accountcode']['de-de'] = '';
$text['description-fax_accountcode']['es-cl'] = '';
$text['description-fax_accountcode']['es-mx'] = '';
$text['description-fax_accountcode']['fr-ca'] = '';
$text['description-fax_accountcode']['fr-fr'] = '';
$text['description-fax_accountcode']['he-il'] = '';
$text['description-fax_accountcode']['it-it'] = '';
$text['description-fax_accountcode']['nl-nl'] = '';
$text['description-fax_accountcode']['pl-pl'] = '';
$text['description-fax_accountcode']['pt-br'] = '';
$text['description-fax_accountcode']['pt-pt'] = '';
$text['description-fax_accountcode']['ro-ro'] = '';
$text['description-fax_accountcode']['ru-ru'] = '';
$text['description-fax_accountcode']['sv-se'] = '';
$text['description-fax_accountcode']['uk-ua'] = '';
$text['label-fax_command']['en-us'] = 'Command';
$text['label-fax_command']['ar-eg'] = '';
$text['label-fax_command']['de-at'] = '';
$text['label-fax_command']['de-ch'] = '';
$text['label-fax_command']['de-de'] = '';
$text['label-fax_command']['es-cl'] = '';
$text['label-fax_command']['es-mx'] = '';
$text['label-fax_command']['fr-ca'] = '';
$text['label-fax_command']['fr-fr'] = '';
$text['label-fax_command']['he-il'] = '';
$text['label-fax_command']['it-it'] = '';
$text['label-fax_command']['nl-nl'] = '';
$text['label-fax_command']['pl-pl'] = '';
$text['label-fax_command']['pt-br'] = '';
$text['label-fax_command']['pt-pt'] = '';
$text['label-fax_command']['ro-ro'] = '';
$text['label-fax_command']['ru-ru'] = '';
$text['label-fax_command']['sv-se'] = '';
$text['label-fax_command']['uk-ua'] = '';
$text['description-fax_command']['en-us'] = 'Enter the fax command.';
$text['description-fax_command']['ar-eg'] = '';
$text['description-fax_command']['de-at'] = '';
$text['description-fax_command']['de-ch'] = '';
$text['description-fax_command']['de-de'] = '';
$text['description-fax_command']['es-cl'] = '';
$text['description-fax_command']['es-mx'] = '';
$text['description-fax_command']['fr-ca'] = '';
$text['description-fax_command']['fr-fr'] = '';
$text['description-fax_command']['he-il'] = '';
$text['description-fax_command']['it-it'] = '';
$text['description-fax_command']['nl-nl'] = '';
$text['description-fax_command']['pl-pl'] = '';
$text['description-fax_command']['pt-br'] = '';
$text['description-fax_command']['pt-pt'] = '';
$text['description-fax_command']['ro-ro'] = '';
$text['description-fax_command']['ru-ru'] = '';
$text['description-fax_command']['sv-se'] = '';
$text['description-fax_command']['uk-ua'] = '';
?>

View File

@@ -0,0 +1,19 @@
<?php
$apps[$x]['menu'][0]['title']['en-us'] = 'FAX Queue';
$apps[$x]['menu'][0]['title']['es-cl'] = '';
$apps[$x]['menu'][0]['title']['fr-fr'] = '';
$apps[$x]['menu'][0]['title']['fr-ca'] = '';
$apps[$x]['menu'][0]['title']['pl'] = '';
$apps[$x]['menu'][0]['title']['sv-se'] = '';
$apps[$x]['menu'][0]['title']['uk'] = '';
$apps[$x]['menu'][0]['title']['de-at'] = '';
$apps[$x]['menu'][0]['uuid'] = '88fd4b3e-30b2-4514-be1d-6870aa97d652';
$apps[$x]['menu'][0]['parent_uuid'] = '594d99c5-6128-9c88-ca35-4b33392cec0f';
$apps[$x]['menu'][0]['category'] = 'internal';
$apps[$x]['menu'][0]['path'] = '/app/fax_queue/fax_queue.php';
$apps[$x]['menu'][0]['groups'][] = 'superadmin';
//$apps[$x]['menu'][0]['groups'][] = 'admin';
//$apps[$x]['menu'][0]['groups'][] = 'user';
?>

291
app/fax_queue/fax_queue.php Normal file
View File

@@ -0,0 +1,291 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2022
the Initial Developer. All Rights Reserved.
*/
//includes
require_once "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
require_once "resources/paging.php";
//check permissions
if (permission_exists('fax_queue_view')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get();
//get the http post data
if (is_array($_POST['fax_queue'])) {
$action = $_POST['action'];
$search = $_POST['search'];
$fax_queue = $_POST['fax_queue'];
}
//process the http post data by action
if ($action != '' && is_array($fax_queue) && @sizeof($fax_queue) != 0) {
switch ($action) {
case 'copy':
if (permission_exists('fax_queue_add')) {
$obj = new fax_queue;
$obj->copy($fax_queue);
}
break;
//case 'toggle':
// if (permission_exists('fax_queue_edit')) {
// $obj = new fax_queue;
// $obj->toggle($fax_queue);
// }
// break;
case 'delete':
if (permission_exists('fax_queue_delete')) {
$obj = new fax_queue;
$obj->delete($fax_queue);
}
break;
}
//redirect the user
header('Location: fax_queue.php'.($search != '' ? '?search='.urlencode($search) : null));
exit;
}
//get order and order by
$order_by = $_GET["order_by"];
$order = $_GET["order"];
//add the search
if (isset($_GET["search"])) {
$search = strtolower($_GET["search"]);
}
//get the count
$sql = "select count(fax_queue_uuid) ";
$sql .= "from v_fax_queue ";
if (isset($search)) {
$sql .= "where (";
$sql .= " lower(hostname) like :search ";
$sql .= " or lower(fax_caller_id_name) like :search ";
$sql .= " or lower(fax_caller_id_number) like :search ";
$sql .= " or lower(fax_number) like :search ";
$sql .= " or lower(fax_email_address) like :search ";
$sql .= " or lower(fax_file) like :search ";
$sql .= " or lower(fax_status) like :search ";
$sql .= " or lower(fax_accountcode) like :search ";
$sql .= ") ";
$parameters['search'] = '%'.$search.'%';
}
else {
$sql .= "where (domain_uuid = :domain_uuid or domain_uuid is null) ";
if (isset($sql_search)) {
$sql .= "and ".$sql_search;
}
$parameters['domain_uuid'] = $domain_uuid;
}
$database = new database;
$num_rows = $database->select($sql, $parameters, 'column');
unset($sql, $parameters);
//prepare to page the results
$rows_per_page = ($_SESSION['domain']['paging']['numeric'] != '') ? $_SESSION['domain']['paging']['numeric'] : 50;
$param = $search ? "&search=".$search : null;
$param = ($_GET['show'] == 'all' && permission_exists('fax_queue_all')) ? "&show=all" : null;
$page = is_numeric($_GET['page']) ? $_GET['page'] : 0;
list($paging_controls, $rows_per_page) = paging($num_rows, $param, $rows_per_page);
list($paging_controls_mini, $rows_per_page) = paging($num_rows, $param, $rows_per_page, true);
$offset = $rows_per_page * $page;
//get the list
$sql = "select ";
$sql .= "fax_queue_uuid, ";
$sql .= "fax_uuid, ";
$sql .= "fax_date, ";
$sql .= "hostname, ";
$sql .= "fax_caller_id_name, ";
$sql .= "fax_caller_id_number, ";
$sql .= "fax_number, ";
$sql .= "fax_prefix, ";
$sql .= "fax_email_address, ";
$sql .= "fax_file, ";
$sql .= "fax_status, ";
$sql .= "fax_retry_date, ";
$sql .= "fax_retry_count, ";
$sql .= "fax_accountcode, ";
$sql .= "fax_command ";
$sql .= "from v_fax_queue ";
if (isset($_GET["search"])) {
$sql .= "where (";
$sql .= " lower(hostname) like :search ";
$sql .= " or lower(fax_caller_id_name) like :search ";
$sql .= " or lower(fax_caller_id_number) like :search ";
$sql .= " or lower(fax_number) like :search ";
$sql .= " or lower(fax_email_address) like :search ";
$sql .= " or lower(fax_file) like :search ";
$sql .= " or lower(fax_status) like :search ";
$sql .= " or lower(fax_accountcode) like :search ";
$sql .= ") ";
$parameters['search'] = '%'.$search.'%';
}
$sql .= order_by($order_by, $order, '', '');
$sql .= limit_offset($rows_per_page, $offset);
$database = new database;
$fax_queue = $database->select($sql, $parameters, 'all');
unset($sql, $parameters);
//create token
$object = new token;
$token = $object->create($_SERVER['PHP_SELF']);
//additional includes
$document['title'] = $text['title-fax_queue'];
require_once "resources/header.php";
//show the content
echo "<div class='action_bar' id='action_bar'>\n";
echo " <div class='heading'><b>".$text['title-fax_queue']." (".$num_rows.")</b></div>\n";
echo " <div class='actions'>\n";
//if (permission_exists('fax_queue_add')) {
// echo button::create(['type'=>'button','label'=>$text['button-add'],'icon'=>$_SESSION['theme']['button_icon_add'],'id'=>'btn_add','name'=>'btn_add','link'=>'fax_queue_edit.php']);
//}
if (permission_exists('fax_queue_add') && $fax_queue) {
echo button::create(['type'=>'button','label'=>$text['button-copy'],'icon'=>$_SESSION['theme']['button_icon_copy'],'id'=>'btn_copy','name'=>'btn_copy','style'=>'display:none;','onclick'=>"modal_open('modal-copy','btn_copy');"]);
}
//if (permission_exists('fax_queue_edit') && $fax_queue) {
// echo button::create(['type'=>'button','label'=>$text['button-toggle'],'icon'=>$_SESSION['theme']['button_icon_toggle'],'id'=>'btn_toggle','name'=>'btn_toggle','style'=>'display:none;','onclick'=>"modal_open('modal-toggle','btn_toggle');"]);
//}
if (permission_exists('fax_queue_delete') && $fax_queue) {
echo button::create(['type'=>'button','label'=>$text['button-delete'],'icon'=>$_SESSION['theme']['button_icon_delete'],'id'=>'btn_delete','name'=>'btn_delete','style'=>'display:none;','onclick'=>"modal_open('modal-delete','btn_delete');"]);
}
echo "<form id='form_search' class='inline' method='get'>\n";
if (permission_exists('fax_queue_all')) {
if ($_GET['show'] == 'all') {
echo " <input type='hidden' name='show' value='all'>\n";
}
else {
echo button::create(['type'=>'button','label'=>$text['button-show_all'],'icon'=>$_SESSION['theme']['button_icon_all'],'link'=>'?show=all']);
}
}
echo "<input type='text' class='txt list-search' name='search' id='search' value=\"".escape($search)."\" placeholder=\"".$text['label-search']."\" onkeydown='list_search_reset();'>";
echo button::create(['label'=>$text['button-search'],'icon'=>$_SESSION['theme']['button_icon_search'],'type'=>'submit','id'=>'btn_search','style'=>($search != '' ? 'display: none;' : null)]);
echo button::create(['label'=>$text['button-reset'],'icon'=>$_SESSION['theme']['button_icon_reset'],'type'=>'button','id'=>'btn_reset','link'=>'fax_queue.php','style'=>($search == '' ? 'display: none;' : null)]);
if ($paging_controls_mini != '') {
echo "<span style='margin-left: 15px;'>".$paging_controls_mini."</span>\n";
}
echo " </form>\n";
echo " </div>\n";
echo " <div style='clear: both;'></div>\n";
echo "</div>\n";
if (permission_exists('fax_queue_add') && $fax_queue) {
echo modal::create(['id'=>'modal-copy','type'=>'copy','actions'=>button::create(['type'=>'button','label'=>$text['button-continue'],'icon'=>'check','id'=>'btn_copy','style'=>'float: right; margin-left: 15px;','collapse'=>'never','onclick'=>"modal_close(); list_action_set('copy'); list_form_submit('form_list');"])]);
}
//if (permission_exists('fax_queue_edit') && $fax_queue) {
// echo modal::create(['id'=>'modal-toggle','type'=>'toggle','actions'=>button::create(['type'=>'button','label'=>$text['button-continue'],'icon'=>'check','id'=>'btn_toggle','style'=>'float: right; margin-left: 15px;','collapse'=>'never','onclick'=>"modal_close(); list_action_set('toggle'); list_form_submit('form_list');"])]);
//}
if (permission_exists('fax_queue_delete') && $fax_queue) {
echo modal::create(['id'=>'modal-delete','type'=>'delete','actions'=>button::create(['type'=>'button','label'=>$text['button-continue'],'icon'=>'check','id'=>'btn_delete','style'=>'float: right; margin-left: 15px;','collapse'=>'never','onclick'=>"modal_close(); list_action_set('delete'); list_form_submit('form_list');"])]);
}
echo "<form id='form_list' method='post'>\n";
echo "<input type='hidden' id='action' name='action' value=''>\n";
echo "<input type='hidden' name='search' value=\"".escape($search)."\">\n";
echo "<table class='list'>\n";
echo "<tr class='list-header'>\n";
if (permission_exists('fax_queue_add') || permission_exists('fax_queue_edit') || permission_exists('fax_queue_delete')) {
echo " <th class='checkbox'>\n";
echo " <input type='checkbox' id='checkbox_all' name='checkbox_all' onclick='list_all_toggle(); checkbox_on_change(this);' ".($fax_queue ?: "style='visibility: hidden;'").">\n";
echo " </th>\n";
}
if ($_GET['show'] == 'all' && permission_exists('fax_queue_all')) {
echo th_order_by('domain_name', $text['label-domain'], $order_by, $order);
}
echo th_order_by('fax_date', $text['label-fax_date'], $order_by, $order);
echo th_order_by('hostname', $text['label-hostname'], $order_by, $order);
echo th_order_by('fax_caller_id_name', $text['label-fax_caller_id_name'], $order_by, $order);
echo th_order_by('fax_caller_id_number', $text['label-fax_caller_id_number'], $order_by, $order);
echo th_order_by('fax_number', $text['label-fax_number'], $order_by, $order);
echo th_order_by('fax_email_address', $text['label-fax_email_address'], $order_by, $order);
echo th_order_by('fax_file', $text['label-fax_file'], $order_by, $order);
echo th_order_by('fax_status', $text['label-fax_status'], $order_by, $order);
echo th_order_by('fax_retry_date', $text['label-fax_retry_date'], $order_by, $order);
echo th_order_by('fax_retry_count', $text['label-fax_retry_count'], $order_by, $order);
if (permission_exists('fax_queue_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
echo " <td class='action-button'>&nbsp;</td>\n";
}
echo "</tr>\n";
if (is_array($fax_queue) && @sizeof($fax_queue) != 0) {
$x = 0;
foreach ($fax_queue as $row) {
if (permission_exists('fax_queue_edit')) {
$list_row_url = "fax_queue_edit.php?id=".urlencode($row['fax_queue_uuid']);
}
echo "<tr class='list-row' href='".$list_row_url."'>\n";
if (permission_exists('fax_queue_add') || permission_exists('fax_queue_edit') || permission_exists('fax_queue_delete')) {
echo " <td class='checkbox'>\n";
echo " <input type='checkbox' name='fax_queue[$x][checked]' id='checkbox_".$x."' value='true' onclick=\"checkbox_on_change(this); if (!this.checked) { document.getElementById('checkbox_all').checked = false; }\">\n";
echo " <input type='hidden' name='fax_queue[$x][fax_queue_uuid]' value='".escape($row['fax_queue_uuid'])."' />\n";
echo " </td>\n";
}
if ($_GET['show'] == 'all' && permission_exists('fax_queue_all')) {
echo " <td>".escape($_SESSION['domains'][$row['domain_uuid']]['domain_name'])."</td>\n";
}
echo " <td>".escape($row['fax_date'])."</td>\n";
echo " <td>".escape($row['hostname'])."</td>\n";
echo " <td>".escape($row['fax_caller_id_name'])."</td>\n";
echo " <td>".escape($row['fax_caller_id_number'])."</td>\n";
echo " <td>".escape($row['fax_number'])."</td>\n";
echo " <td>".escape($row['fax_email_address'])."</td>\n";
echo " <td>".escape($row['fax_file'])."</td>\n";
echo " <td>".escape($row['fax_status'])."</td>\n";
echo " <td>".escape($row['fax_retry_date'])."</td>\n";
echo " <td>".escape($row['fax_retry_count'])."</td>\n";
if (permission_exists('fax_queue_edit') && $_SESSION['theme']['list_row_edit_button']['boolean'] == 'true') {
echo " <td class='action-button'>\n";
echo button::create(['type'=>'button','title'=>$text['button-edit'],'icon'=>$_SESSION['theme']['button_icon_edit'],'link'=>$list_row_url]);
echo " </td>\n";
}
echo "</tr>\n";
$x++;
}
unset($fax_queue);
}
echo "</table>\n";
echo "<br />\n";
echo "<div align='center'>".$paging_controls."</div>\n";
echo "<input type='hidden' name='".$token['name']."' value='".$token['hash']."'>\n";
echo "</form>\n";
//include the footer
require_once "resources/footer.php";
?>

View File

@@ -0,0 +1,41 @@
<?php
//includes
require_once "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
//check permissions
if (permission_exists('fax_queue_delete')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get();
//delete the message
message::add($text['message-delete']);
//delete the data
if (isset($_GET["id"]) && is_uuid($_GET["id"])) {
//get the id
$id = $_GET["id"];
//delete the data
$array['fax_queue'][]['fax_queue_uuid'] = $id;
$database = new database;
$database->delete($array);
unset($array);
//redirect the user
header('Location: fax_queues.php');
}
?>

View File

@@ -0,0 +1,437 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2022
the Initial Developer. All Rights Reserved.
*/
//includes
require_once "root.php";
require_once "resources/require.php";
require_once "resources/check_auth.php";
//check permissions
if (permission_exists('fax_queue_add') || permission_exists('fax_queue_edit')) {
//access granted
}
else {
echo "access denied";
exit;
}
//add multi-lingual support
$language = new text;
$text = $language->get();
//action add or update
if (is_uuid($_REQUEST["id"])) {
$action = "update";
$fax_queue_uuid = $_REQUEST["id"];
$id = $_REQUEST["id"];
}
else {
$action = "add";
}
//get http post variables and set them to php variables
if (is_array($_POST)) {
$fax_uuid = $_POST["fax_uuid"];
$fax_date = $_POST["fax_date"];
$hostname = $_POST["hostname"];
$fax_caller_id_name = $_POST["fax_caller_id_name"];
$fax_caller_id_number = $_POST["fax_caller_id_number"];
$fax_number = $_POST["fax_number"];
$fax_prefix = $_POST["fax_prefix"];
$fax_email_address = $_POST["fax_email_address"];
$fax_file = $_POST["fax_file"];
$fax_status = $_POST["fax_status"];
$fax_retry_date = $_POST["fax_retry_date"];
$fax_retry_count = $_POST["fax_retry_count"];
$fax_accountcode = $_POST["fax_accountcode"];
$fax_command = $_POST["fax_command"];
}
//process the user data and save it to the database
if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
//validate the token
$token = new token;
if (!$token->validate($_SERVER['PHP_SELF'])) {
message::add($text['message-invalid_token'],'negative');
header('Location: fax_queue.php');
exit;
}
//process the http post data by submitted action
if ($_POST['action'] != '' && strlen($_POST['action']) > 0) {
//prepare the array(s)
//send the array to the database class
switch ($_POST['action']) {
case 'copy':
if (permission_exists('fax_queue_add')) {
$obj = new database;
$obj->copy($array);
}
break;
case 'delete':
if (permission_exists('fax_queue_delete')) {
$obj = new database;
$obj->delete($array);
}
break;
case 'toggle':
if (permission_exists('fax_queue_update')) {
$obj = new database;
$obj->toggle($array);
}
break;
}
//redirect the user
if (in_array($_POST['action'], array('copy', 'delete', 'toggle') && is_uuid($id))) {
header('Location: fax_queue_edit.php?id='.$id);
exit;
}
}
//check for all required data
$msg = '';
//if (strlen($fax_uuid) == 0) { $msg .= $text['message-required']." ".$text['label-fax_uuid']."<br>\n"; }
if (strlen($fax_date) == 0) { $msg .= $text['message-required']." ".$text['label-fax_date']."<br>\n"; }
if (strlen($hostname) == 0) { $msg .= $text['message-required']." ".$text['label-hostname']."<br>\n"; }
//if (strlen($fax_caller_id_name) == 0) { $msg .= $text['message-required']." ".$text['label-fax_caller_id_name']."<br>\n"; }
//if (strlen($fax_caller_id_number) == 0) { $msg .= $text['message-required']." ".$text['label-fax_caller_id_number']."<br>\n"; }
if (strlen($fax_number) == 0) { $msg .= $text['message-required']." ".$text['label-fax_number']."<br>\n"; }
//if (strlen($fax_prefix) == 0) { $msg .= $text['message-required']." ".$text['label-fax_prefix']."<br>\n"; }
if (strlen($fax_email_address) == 0) { $msg .= $text['message-required']." ".$text['label-fax_email_address']."<br>\n"; }
if (strlen($fax_file) == 0) { $msg .= $text['message-required']." ".$text['label-fax_file']."<br>\n"; }
if (strlen($fax_status) == 0) { $msg .= $text['message-required']." ".$text['label-fax_status']."<br>\n"; }
//if (strlen($fax_retry_date) == 0) { $msg .= $text['message-required']." ".$text['label-fax_retry_date']."<br>\n"; }
//if (strlen($fax_retry_count) == 0) { $msg .= $text['message-required']." ".$text['label-fax_retry_count']."<br>\n"; }
if (strlen($fax_accountcode) == 0) { $msg .= $text['message-required']." ".$text['label-fax_accountcode']."<br>\n"; }
//if (strlen($fax_command) == 0) { $msg .= $text['message-required']." ".$text['label-fax_command']."<br>\n"; }
if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
require_once "resources/header.php";
require_once "resources/persist_form_var.php";
echo "<div align='center'>\n";
echo "<table><tr><td>\n";
echo $msg."<br />";
echo "</td></tr></table>\n";
persistformvar($_POST);
echo "</div>\n";
require_once "resources/footer.php";
return;
}
//add the fax_queue_uuid
if (!is_uuid($_POST["fax_queue_uuid"])) {
$fax_queue_uuid = uuid();
}
//prepare the array
$array['fax_queue'][0]['fax_queue_uuid'] = $fax_queue_uuid;
$array['fax_queue'][0]['domain_uuid'] = $_SESSION['domain_uuid'];
//$array['fax_queue'][0]['fax_uuid'] = $fax_uuid;
$array['fax_queue'][0]['fax_date'] = $fax_date;
$array['fax_queue'][0]['hostname'] = $hostname;
$array['fax_queue'][0]['fax_caller_id_name'] = $fax_caller_id_name;
$array['fax_queue'][0]['fax_caller_id_number'] = $fax_caller_id_number;
$array['fax_queue'][0]['fax_number'] = $fax_number;
$array['fax_queue'][0]['fax_prefix'] = $fax_prefix;
$array['fax_queue'][0]['fax_email_address'] = $fax_email_address;
$array['fax_queue'][0]['fax_file'] = $fax_file;
$array['fax_queue'][0]['fax_status'] = $fax_status;
$array['fax_queue'][0]['fax_retry_date'] = $fax_retry_date;
$array['fax_queue'][0]['fax_retry_count'] = $fax_retry_count;
$array['fax_queue'][0]['fax_accountcode'] = $fax_accountcode;
$array['fax_queue'][0]['fax_command'] = $fax_command;
//save the data
$database = new database;
$database->app_name = 'fax queue';
$database->app_uuid = '3656287f-4b22-4cf1-91f6-00386bf488f4';
$database->save($array);
//redirect the user
if (isset($action)) {
if ($action == "add") {
$_SESSION["message"] = $text['message-add'];
}
if ($action == "update") {
$_SESSION["message"] = $text['message-update'];
}
//header('Location: fax_queue.php');
header('Location: fax_queue_edit.php?id='.urlencode($fax_queue_uuid));
return;
}
}
//pre-populate the form
if (is_array($_GET) && $_POST["persistformvar"] != "true") {
$sql = "select ";
$sql .= " fax_uuid, ";
$sql .= " fax_date, ";
$sql .= " hostname, ";
$sql .= " fax_caller_id_name, ";
$sql .= " fax_caller_id_number, ";
$sql .= " fax_number, ";
$sql .= " fax_prefix, ";
$sql .= " fax_email_address, ";
$sql .= " fax_file, ";
$sql .= " fax_status, ";
$sql .= " fax_retry_date, ";
$sql .= " fax_retry_count, ";
$sql .= " fax_accountcode, ";
$sql .= " fax_command ";
$sql .= "from v_fax_queue ";
$sql .= "where fax_queue_uuid = :fax_queue_uuid ";
//$sql .= "and domain_uuid = :domain_uuid ";
//$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
$parameters['fax_queue_uuid'] = $fax_queue_uuid;
$database = new database;
$row = $database->select($sql, $parameters, 'row');
if (is_array($row) && @sizeof($row) != 0) {
$fax_uuid = $row["fax_uuid"];
$fax_date = $row["fax_date"];
$hostname = $row["hostname"];
$fax_caller_id_name = $row["fax_caller_id_name"];
$fax_caller_id_number = $row["fax_caller_id_number"];
$fax_number = $row["fax_number"];
$fax_prefix = $row["fax_prefix"];
$fax_email_address = $row["fax_email_address"];
$fax_file = $row["fax_file"];
$fax_status = $row["fax_status"];
$fax_retry_date = $row["fax_retry_date"];
$fax_retry_count = $row["fax_retry_count"];
$fax_accountcode = $row["fax_accountcode"];
$fax_command = $row["fax_command"];
}
unset($sql, $parameters, $row);
}
//create token
$object = new token;
$token = $object->create($_SERVER['PHP_SELF']);
//show the header
$document['title'] = $text['title-fax_queue'];
require_once "resources/header.php";
//show the content
echo "<form name='frm' id='frm' method='post' action=''>\n";
echo "<input class='formfld' type='hidden' name='fax_queue_uuid' value='".escape($fax_queue_uuid)."'>\n";
echo "<div class='action_bar' id='action_bar'>\n";
echo " <div class='heading'><b>".$text['title-fax_queue']."</b></div>\n";
echo " <div class='actions'>\n";
echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'id'=>'btn_back','collapse'=>'hide-xs','style'=>'margin-right: 15px;','link'=>'fax_queue.php']);
if ($action == 'update') {
if (permission_exists('_add')) {
echo button::create(['type'=>'button','label'=>$text['button-copy'],'icon'=>$_SESSION['theme']['button_icon_copy'],'id'=>'btn_copy','name'=>'btn_copy','style'=>'display: none;','onclick'=>"modal_open('modal-copy','btn_copy');"]);
}
if (permission_exists('_delete')) {
echo button::create(['type'=>'button','label'=>$text['button-delete'],'icon'=>$_SESSION['theme']['button_icon_delete'],'id'=>'btn_delete','name'=>'btn_delete','style'=>'display: none; margin-right: 15px;','onclick'=>"modal_open('modal-delete','btn_delete');"]);
}
}
echo button::create(['type'=>'submit','label'=>$text['button-save'],'icon'=>$_SESSION['theme']['button_icon_save'],'id'=>'btn_save','collapse'=>'hide-xs']);
echo " </div>\n";
echo " <div style='clear: both;'></div>\n";
echo "</div>\n";
echo $text['title_description-fax_queue']."\n";
echo "<br /><br />\n";
if ($action == 'update') {
if (permission_exists('fax_queue_add')) {
echo modal::create(['id'=>'modal-copy','type'=>'copy','actions'=>button::create(['type'=>'submit','label'=>$text['button-continue'],'icon'=>'check','id'=>'btn_copy','style'=>'float: right; margin-left: 15px;','collapse'=>'never','name'=>'action','value'=>'copy','onclick'=>"modal_close();"])]);
}
if (permission_exists('fax_queue_delete')) {
echo modal::create(['id'=>'modal-delete','type'=>'delete','actions'=>button::create(['type'=>'submit','label'=>$text['button-continue'],'icon'=>'check','id'=>'btn_delete','style'=>'float: right; margin-left: 15px;','collapse'=>'never','name'=>'action','value'=>'delete','onclick'=>"modal_close();"])]);
}
}
echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
//echo "<tr>\n";
//echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
//echo " ".$text['label-fax_uuid']."\n";
//echo "</td>\n";
//echo "<td class='vtable' style='position: relative;' align='left'>\n";
//echo " <input class='formfld' type='text' name='fax_uuid' maxlength='255' value='".escape($fax_uuid)."'>\n";
//echo "<br />\n";
//echo $text['description-fax_uuid']."\n";
//echo "</td>\n";
//echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-fax_date']."\n";
echo "</td>\n";
echo "<td class='vtable' style='position: relative;' align='left'>\n";
echo " <input class='formfld' type='text' name='fax_date' maxlength='255' value='".escape($fax_date)."'>\n";
echo "<br />\n";
echo $text['description-fax_date']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-hostname']."\n";
echo "</td>\n";
echo "<td class='vtable' style='position: relative;' align='left'>\n";
echo " <input class='formfld' type='text' name='hostname' maxlength='255' value='".escape($hostname)."'>\n";
echo "<br />\n";
echo $text['description-hostname']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-fax_caller_id_name']."\n";
echo "</td>\n";
echo "<td class='vtable' style='position: relative;' align='left'>\n";
echo " <input class='formfld' type='text' name='fax_caller_id_name' maxlength='255' value='".escape($fax_caller_id_name)."'>\n";
echo "<br />\n";
echo $text['description-fax_caller_id_name']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-fax_caller_id_number']."\n";
echo "</td>\n";
echo "<td class='vtable' style='position: relative;' align='left'>\n";
echo " <input class='formfld' type='text' name='fax_caller_id_number' maxlength='255' value='".escape($fax_caller_id_number)."'>\n";
echo "<br />\n";
echo $text['description-fax_caller_id_number']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-fax_number']."\n";
echo "</td>\n";
echo "<td class='vtable' style='position: relative;' align='left'>\n";
echo " <input class='formfld' type='text' name='fax_number' maxlength='255' value='".escape($fax_number)."'>\n";
echo "<br />\n";
echo $text['description-fax_number']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-fax_prefix']."\n";
echo "</td>\n";
echo "<td class='vtable' style='position: relative;' align='left'>\n";
echo " <input class='formfld' type='text' name='fax_prefix' maxlength='255' value='".escape($fax_prefix)."'>\n";
echo "<br />\n";
echo $text['description-fax_prefix']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-fax_email_address']."\n";
echo "</td>\n";
echo "<td class='vtable' style='position: relative;' align='left'>\n";
echo " <input class='formfld' type='text' name='fax_email_address' maxlength='255' value='".escape($fax_email_address)."'>\n";
echo "<br />\n";
echo $text['description-fax_email_address']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-fax_file']."\n";
echo "</td>\n";
echo "<td class='vtable' style='position: relative;' align='left'>\n";
echo " <input class='formfld' type='text' name='fax_file' maxlength='255' value='".escape($fax_file)."'>\n";
echo "<br />\n";
echo $text['description-fax_file']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-fax_status']."\n";
echo "</td>\n";
echo "<td class='vtable' style='position: relative;' align='left'>\n";
echo " <input class='formfld' type='text' name='fax_status' maxlength='255' value='".escape($fax_status)."'>\n";
echo "<br />\n";
echo $text['description-fax_status']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-fax_retry_date']."\n";
echo "</td>\n";
echo "<td class='vtable' style='position: relative;' align='left'>\n";
echo " <input class='formfld' type='text' name='fax_retry_date' maxlength='255' value='".escape($fax_retry_date)."'>\n";
echo "<br />\n";
echo $text['description-fax_retry_date']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-fax_retry_count']."\n";
echo "</td>\n";
echo "<td class='vtable' style='position: relative;' align='left'>\n";
echo " <input class='formfld' type='text' name='fax_retry_count' maxlength='255' value='".escape($fax_retry_count)."'>\n";
echo "<br />\n";
echo $text['description-fax_retry_count']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-fax_accountcode']."\n";
echo "</td>\n";
echo "<td class='vtable' style='position: relative;' align='left'>\n";
echo " <input class='formfld' type='text' name='fax_accountcode' maxlength='255' value='".escape($fax_accountcode)."'>\n";
echo "<br />\n";
echo $text['description-fax_accountcode']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "<tr>\n";
echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
echo " ".$text['label-fax_command']."\n";
echo "</td>\n";
echo "<td class='vtable' style='position: relative;' align='left'>\n";
echo " <textarea class='formfld' name='fax_command' style='width: 185px; height: 80px;'>".$fax_command."</textarea>\n";
echo "<br />\n";
echo $text['description-fax_command']."\n";
echo "</td>\n";
echo "</tr>\n";
echo "</table>";
echo "<br /><br />";
echo "<input type='hidden' name='".$token['name']."' value='".$token['hash']."'>\n";
echo "</form>";
//include the footer
require_once "resources/footer.php";
?>

View File

@@ -0,0 +1,263 @@
<?php
/*
FusionPBX
Version: MPL 1.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is FusionPBX
The Initial Developer of the Original Code is
Mark J Crane <markjcrane@fusionpbx.com>
Portions created by the Initial Developer are Copyright (C) 2019 - 2021
the Initial Developer. All Rights Reserved.
Contributor(s):
Mark J Crane <markjcrane@fusionpbx.com>
*/
/**
* fax_queue class
*
* @method null delete
* @method null toggle
* @method null copy
*/
if (!class_exists('fax_queue')) {
class fax_queue {
/**
* declare the variables
*/
private $app_name;
private $app_uuid;
private $name;
private $table;
private $toggle_field;
private $toggle_values;
private $location;
/**
* called when the object is created
*/
public function __construct() {
//assign the variables
$this->app_name = 'fax_queue';
$this->app_uuid = '3656287f-4b22-4cf1-91f6-00386bf488f4';
$this->name = 'fax_queue';
$this->table = 'fax_queue';
$this->toggle_field = '';
$this->toggle_values = ['true','false'];
$this->location = 'fax_queue.php';
}
/**
* called when there are no references to a particular object
* unset the variables used in the class
*/
public function __destruct() {
foreach ($this as $key => $value) {
unset($this->$key);
}
}
/**
* delete rows from the database
*/
public function delete($records) {
if (permission_exists($this->name.'_delete')) {
//add multi-lingual support
$language = new text;
$text = $language->get();
//validate the token
$token = new token;
if (!$token->validate($_SERVER['PHP_SELF'])) {
message::add($text['message-invalid_token'],'negative');
header('Location: '.$this->location);
exit;
}
//delete multiple records
if (is_array($records) && @sizeof($records) != 0) {
//build the delete array
$x = 0;
foreach ($records as $record) {
//add to the array
if ($record['checked'] == 'true' && is_uuid($record['fax_queue_uuid'])) {
$array[$this->table][$x]['fax_queue_uuid'] = $record['fax_queue_uuid'];
$array[$this->table][$x]['domain_uuid'] = $_SESSION['domain_uuid'];
}
//increment the id
$x++;
}
//delete the checked rows
if (is_array($array) && @sizeof($array) != 0) {
//execute delete
$database = new database;
$database->app_name = $this->app_name;
$database->app_uuid = $this->app_uuid;
$database->delete($array);
unset($array);
//set message
message::add($text['message-delete']);
}
unset($records);
}
}
}
/**
* toggle a field between two values
*/
public function toggle($records) {
if (permission_exists($this->name.'_edit')) {
//add multi-lingual support
$language = new text;
$text = $language->get();
//validate the token
$token = new token;
if (!$token->validate($_SERVER['PHP_SELF'])) {
message::add($text['message-invalid_token'],'negative');
header('Location: '.$this->location);
exit;
}
//toggle the checked records
if (is_array($records) && @sizeof($records) != 0) {
//get current toggle state
foreach($records as $record) {
if ($record['checked'] == 'true' && is_uuid($record['fax_queue_uuid'])) {
$uuids[] = "'".$record['fax_queue_uuid']."'";
}
}
if (is_array($uuids) && @sizeof($uuids) != 0) {
$sql = "select ".$this->name."_uuid as uuid, ".$this->toggle_field." as toggle from v_".$this->table." ";
$sql .= "where ".$this->name."_uuid in (".implode(', ', $uuids).") ";
$sql .= "and (domain_uuid = :domain_uuid or domain_uuid is null) ";
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
$database = new database;
$rows = $database->select($sql, $parameters, 'all');
if (is_array($rows) && @sizeof($rows) != 0) {
foreach ($rows as $row) {
$states[$row['uuid']] = $row['toggle'];
}
}
unset($sql, $parameters, $rows, $row);
}
//build update array
$x = 0;
foreach($states as $uuid => $state) {
//create the array
$array[$this->table][$x][$this->name.'_uuid'] = $uuid;
$array[$this->table][$x][$this->toggle_field] = $state == $this->toggle_values[0] ? $this->toggle_values[1] : $this->toggle_values[0];
//increment the id
$x++;
}
//save the changes
if (is_array($array) && @sizeof($array) != 0) {
//save the array
$database = new database;
$database->app_name = $this->app_name;
$database->app_uuid = $this->app_uuid;
$database->save($array);
unset($array);
//set message
message::add($text['message-toggle']);
}
unset($records, $states);
}
}
}
/**
* copy rows from the database
*/
public function copy($records) {
if (permission_exists($this->name.'_add')) {
//add multi-lingual support
$language = new text;
$text = $language->get();
//validate the token
$token = new token;
if (!$token->validate($_SERVER['PHP_SELF'])) {
message::add($text['message-invalid_token'],'negative');
header('Location: '.$this->location);
exit;
}
//copy the checked records
if (is_array($records) && @sizeof($records) != 0) {
//get checked records
foreach($records as $record) {
if ($record['checked'] == 'true' && is_uuid($record['fax_queue_uuid'])) {
$uuids[] = "'".$record['fax_queue_uuid']."'";
}
}
//create the array from existing data
if (is_array($uuids) && @sizeof($uuids) != 0) {
$sql = "select * from v_".$this->table." ";
$sql .= "where fax_queue_uuid in (".implode(', ', $uuids).") ";
$sql .= "and (domain_uuid = :domain_uuid or domain_uuid is null) ";
$parameters['domain_uuid'] = $_SESSION['domain_uuid'];
$database = new database;
$rows = $database->select($sql, $parameters, 'all');
if (is_array($rows) && @sizeof($rows) != 0) {
$x = 0;
foreach ($rows as $row) {
//copy data
$array[$this->table][$x] = $row;
//add copy to the description
$array[$this->table][$x][fax_queue.'_uuid'] = uuid();
//increment the id
$x++;
}
}
unset($sql, $parameters, $rows, $row);
}
//save the changes and set the message
if (is_array($array) && @sizeof($array) != 0) {
//save the array
$database = new database;
$database->app_name = $this->app_name;
$database->app_uuid = $this->app_uuid;
$database->save($array);
unset($array);
//set message
message::add($text['message-copy']);
}
unset($records);
}
}
}
}
}
?>

View File

@@ -0,0 +1,190 @@
<?php
//includes
if (defined('STDIN')) {
$document_root = str_replace("\\", "/", $_SERVER["PHP_SELF"]);
preg_match("/^(.*)\/app\/.*$/", $document_root, $matches);
$document_root = $matches[1];
set_include_path($document_root);
$_SERVER["DOCUMENT_ROOT"] = $document_root;
require_once "resources/require.php";
}
else {
exit;
include "root.php";
require_once "resources/require.php";
require_once "resources/pdo.php";
}
//increase limits
set_time_limit(0);
ini_set('max_execution_time', 0);
ini_set('memory_limit', '512M');
//save the arguments to variables
$script_name = $argv[0];
if (!empty($argv[1])) {
parse_str($argv[1], $_GET);
}
//print_r($_GET);
//set the variables
if (isset($_GET['hostname'])) {
$hostname = urldecode($_GET['hostname']);
}
if (isset($_GET['debug'])) {
$debug = $_GET['debug'];
}
//define the process id file
$pid_file = "/var/run/fusionpbx/".basename( $argv[0], ".php") .".pid";
//echo "pid_file: ".$pid_file."\n";
//function to check if the process exists
function process_exists($file = false) {
//set the default exists to false
$exists = false;
//check to see if the process is running
if (file_exists($file)) {
$pid = file_get_contents($file);
if (posix_getsid($pid) === false) {
//process is not running
$exists = false;
}
else {
//process is running
$exists = true;
}
}
//return the result
return $exists;
}
//get the default settings settings
$fax_queue_interval = $_SESSION['fax_queue']['interval']['numeric'];
//set the defaults
if (!is_numeric($interval)) { $interval = 30; }
//set the email queue limit
if (isset($_SESSION['fax_queue']['limit']['numeric'])) {
$fax_queue_limit = $_SESSION['fax_queue']['limit']['numeric'];
}
else {
$fax_queue_limit = '30';
}
if (isset($_SESSION['fax_queue']['debug']['boolean'])) {
$debug = $_SESSION['fax_queue']['debug']['boolean'];
}
//check to see if the process exists
$pid_exists = process_exists($pid_file);
//prevent the process running more than once
if ($pid_exists) {
echo "Cannot lock pid file {$pid_file}\n";
exit;
}
//make sure the /var/run/fusionpbx directory exists
if (!file_exists('/var/run/fusionpbx')) {
$result = mkdir('/var/run/fusionpbx', 0777, true);
if (!$result) {
die('Failed to create /var/run/fusionpbx');
}
}
//create the process id file if the process doesn't exist
if (!$pid_exists) {
//remove the old pid file
if (file_exists($file)) {
unlink($pid_file);
}
//show the details to the user
//echo "The process id is ".getmypid()."\n";
//echo "pid_file: ".$pid_file."\n";
//save the pid file
file_put_contents($pid_file, getmypid());
}
//get the fax messages that are waiting to send
$sql = "select * from v_fax_queue ";
$sql .= "where (fax_status = 'waiting' or fax_status = 'trying') ";
$sql .= "and hostname = :hostname ";
$sql .= "and ( ";
$sql .= " fax_retry_date is null ";
$sql .= " or floor(extract(epoch from now()) - extract(epoch from fax_retry_date)) > :interval ";
$sql .= ") ";
$sql .= "order by domain_uuid asc ";
$sql .= "limit :limit ";
if (isset($hostname)) {
$parameters['hostname'] = $hostname;
}
else {
$parameters['hostname'] = gethostname();
}
$parameters['limit'] = $fax_queue_limit;
$parameters['interval'] = $fax_queue_interval;
$database = new database;
$fax_queue = $database->select($sql, $parameters, 'all');
unset($parameters);
//process the messages
if (is_array($fax_queue) && @sizeof($fax_queue) != 0) {
foreach($fax_queue as $row) {
$command = "/usr/bin/php /var/www/fusionpbx/app/fax_queue/resources/job/fax_send.php ";
$command .= "'action=send&fax_queue_uuid=".$row["fax_queue_uuid"]."&hostname=".$hostname."'";
if (isset($debug)) {
//run process inline to see debug info
echo $command."\n";
$result = system($command);
echo $result."\n";
}
else {
//starts process rapidly doesn't wait for previous process to finish (used for production)
$handle = popen($command." > /dev/null &", 'r');
echo "'$handle'; " . gettype($handle) . "\n";
$read = fread($handle, 2096);
echo $read;
pclose($handle);
}
}
}
//remove the old pid file
if (file_exists($file)) {
unlink($pid_file);
}
//save output to
//$fp = fopen(sys_get_temp_dir()."/mailer-app.log", "a");
//prepare the output buffers
//ob_end_clean();
//ob_start();
//message divider for log file
//echo "\n\n=============================================================================================================================================\n\n";
//get and save the output from the buffer
//$content = ob_get_contents(); //get the output from the buffer
//$content = str_replace("<br />", "", $content);
//ob_end_clean(); //clean the buffer
//fwrite($fp, $content);
//fclose($fp);
//notes
//echo __line__."\n";
// if not keeping the email then need to delete it after the voicemail is emailed
//how to use this feature
// cd /var/www/fusionpbx; /usr/bin/php /var/www/fusionpbx/app/fax_queue/resources/send.php
?>

View File

@@ -0,0 +1,263 @@
<?php
//check the permission
if (defined('STDIN')) {
$document_root = str_replace("\\", "/", $_SERVER["PHP_SELF"]);
preg_match("/^(.*)\/app\/.*$/", $document_root, $matches);
$document_root = $matches[1];
set_include_path($document_root);
$_SERVER["DOCUMENT_ROOT"] = $document_root;
require_once "resources/require.php";
}
else {
exit;
include "root.php";
require_once "resources/require.php";
require_once "resources/pdo.php";
}
//increase limits
set_time_limit(0);
//ini_set('max_execution_time',1800); //30 minutes
ini_set('memory_limit', '512M');
//save the arguments to variables
$script_name = $argv[0];
if (!empty($argv[1])) {
parse_str($argv[1], $_GET);
}
//print_r($_GET);
//set the variables
if (isset($_GET['hostname'])) {
$hostname = urldecode($_GET['hostname']);
}
if (isset($_GET['debug'])) {
$debug = $_GET['debug'];
}
//extract dtmf from the fax number
if (!function_exists('fax_split_dtmf')) {
function fax_split_dtmf(&$fax_number, &$fax_dtmf){
$tmp = array();
$fax_dtmf = '';
if (preg_match('/^\s*(.*?)\s*\((.*)\)\s*$/', $fax_number, $tmp)){
$fax_number = $tmp[1];
$fax_dtmf = $tmp[2];
}
}
}
//set the GET array
if (!empty($argv[1])) {
parse_str($argv[1], $_GET);
}
//get the primary key
$fax_queue_uuid = $_GET['fax_queue_uuid'];
$hostname = $_GET['hostname'];
//get the email details to send
$sql = "select q.*, d.domain_name ";
$sql .= "from v_fax_queue as q, v_domains as d ";
$sql .= "where fax_queue_uuid = :fax_queue_uuid ";
$sql .= "and q.domain_uuid = d.domain_uuid ";
$parameters['fax_queue_uuid'] = $fax_queue_uuid;
$database = new database;
$row = $database->select($sql, $parameters, 'row');
if (is_array($row)) {
$fax_queue_uuid = $row['fax_queue_uuid'];
$domain_uuid = $row['domain_uuid'];
$domain_name = $row['domain_name'];
$fax_uuid = $row['fax_uuid'];
$hostname = $row["hostname"];
$fax_date = $row["fax_date"];
$fax_caller_id_name = $row["fax_caller_id_name"];
$fax_caller_id_number = $row["fax_caller_id_number"];
$fax_prefix = $row["fax_prefix"];
$fax_number = $row["fax_number"];
$fax_email_address = $row["fax_email_address"];
$fax_file = $row["fax_file"];
$fax_status = $row["fax_status"];
$fax_retry_count = $row["fax_retry_count"];
$fax_accountcode = $row["fax_accountcode"];
$fax_command = $row["fax_command"];
}
unset($parameters);
//get some more info to send the fax
$mail_from_address = (isset($_SESSION['fax']['smtp_from']['text'])) ? $_SESSION['fax']['smtp_from']['text'] : $_SESSION['email']['smtp_from']['text'];
//get the call center settings
$retry_limit = $_SESSION['fax_queue']['retry_limit']['numeric'];
//$retry_interval = $_SESSION['fax_queue']['retry_interval']['numeric'];
//prepare the fax retry count
if (strlen($fax_retry_count) == 0) {
$fax_retry_count = 0;
}
else {
$fax_retry_count = $fax_retry_count + 1;
}
//fax options
if ($fax_retry_count == 0) {
$fax_options = "fax_use_ecm=false,fax_enable_t38=true,fax_enable_t38_request=true,fax_disable_v17=default";
}
elseif ($fax_retry_count == 1) {
$fax_options = "fax_use_ecm=true,fax_enable_t38=true,fax_enable_t38_request=true,fax_disable_v17=false";
}
elseif ($fax_retry_count == 2) {
$fax_options = "fax_use_ecm=true,fax_enable_t38=false,fax_enable_t38_request=false,fax_disable_v17=false";
}
elseif ($fax_retry_count == 3) {
$fax_options = "fax_use_ecm=true,fax_enable_t38=true,fax_enable_t38_request=true,fax_disable_v17=true";
}
elseif ($fax_retry_count == 4) {
$fax_options = "fax_use_ecm=false,fax_enable_t38=false,fax_enable_t38_request=false,fax_disable_v17=false";
}
//define the fax file
$tmp_dial_string = "for_fax=1,";
$tmp_dial_string .= "accountcode='" . $fax_accountcode . "',";
$tmp_dial_string .= "sip_h_X-accountcode='" . $fax_accountcode . "',";
$tmp_dial_string .= "domain_uuid=" . $domain_uuid . "',";
$tmp_dial_string .= "domain_name=" . $domain_name . "',";
$tmp_dial_string .= "origination_caller_id_name='" . $fax_caller_id_name . "',";
$tmp_dial_string .= "origination_caller_id_number='" . $fax_caller_id_number . "',";
$tmp_dial_string .= "fax_ident='" . $fax_caller_id_number . "',";
$tmp_dial_string .= "fax_header='" . $fax_caller_id_name . "',";
$tmp_dial_string .= "fax_file='" . $fax_file . "',";
//extract fax_dtmf from the fax number
fax_split_dtmf($fax_number, $fax_dtmf);
//prepare the fax command
if (strlen($fax_toll_allow) > 0) {
$channel_variables["toll_allow"] = $fax_toll_allow;
}
$route_array = outbound_route_to_bridge($domain_uuid, $fax_prefix . $fax_number, $channel_variables);
if (count($route_array) == 0) {
//send the internal call to the registered extension
$fax_uri = "user/".$fax_number."@".$domain_name;
$fax_variables = "";
}
else {
//send the external call
$fax_uri = $route_array[0];
$fax_variables = "";
foreach($_SESSION['fax']['variable'] as $variable) {
$fax_variables .= $variable.",";
}
}
//set the fax file name without the extension
$fax_instance_uuid = pathinfo($fax_file, PATHINFO_FILENAME);
//build a list of fax variables
$dial_string = $tmp_dial_string;
$dial_string .= $fax_variables;
$dial_string .= $fax_options.",";
$dial_string .= "fax_uuid=" . $fax_uuid. ",";
$dial_string .= "fax_queue_uuid=" . $fax_queue_uuid. ",";
$dial_string .= "mailto_address='" . $fax_email_address . "',";
$dial_string .= "mailfrom_address='" . $mail_from_address . "',";
$dial_string .= "fax_uri=" . $fax_uri . ",";
$dial_string .= "fax_retry_attempts=1" . ",";
$dial_string .= "fax_retry_limit=1" . ",";
//$dial_string .= "fax_retry_sleep=180" . ",";
$dial_string .= "fax_verbose=true" . ",";
//$dial_string .= "fax_use_ecm=off" . ",";
$dial_string .= "api_hangup_hook='lua app/fax/resources/scripts/hangup.lua'";
$fax_command = "originate {" . $dial_string . "}" . $fax_uri." &txfax('".$fax_file."')";
//echo $fax_command."\n";
//connect to event socket and send the command
if (file_exists($fax_file)) {
$fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
if ($fp) {
$response = event_socket_request($fp, "api " . $fax_command);
//$response = event_socket_request($fp, $fax_command);
$response = str_replace("\n", "", $response);
$uuid = str_replace("+OK ", "", $response);
echo "uuid ".$uuid."\n";
}
fclose($fp);
}
else {
echo "fax file missing: ".$fax_file."\n";
}
//update the database to say status to trying and set the command
$array['fax_queue'][0]['fax_queue_uuid'] = $fax_queue_uuid;
$array['fax_queue'][0]['domain_uuid'] = $domain_uuid;
if ($fax_retry_count >= $retry_limit) {
$array['fax_queue'][0]['fax_status'] = 'failed';
}
else {
$array['fax_queue'][0]['fax_status'] = 'trying';
}
$array['fax_queue'][0]['fax_retry_count'] = $fax_retry_count;
$array['fax_queue'][0]['fax_retry_date'] = 'now()';
$array['fax_queue'][0]['fax_command'] = $fax_command;
//add temporary permissions
$p = new permissions;
$p->add('fax_queue_edit', 'temp');
//save the data
$database = new database;
$database->app_name = 'fax queue';
$database->app_uuid = '3656287f-4b22-4cf1-91f6-00386bf488f4';
$database->save($array, false);
//remove temporary permissions
$p->delete('fax_queue_edit', 'temp');
//wait for a few seconds
//sleep(1);
//move the generated tif (and pdf) files to the sent directory
//if (file_exists($dir_fax_temp.'/'.$fax_instance_uuid.".tif")) {
// copy($dir_fax_temp.'/'.$fax_instance_uuid.".tif", $dir_fax_sent.'/'.$fax_instance_uuid.".tif");
//}
// if (file_exists($dir_fax_temp.'/'.$fax_instance_uuid.".pdf")) {
// copy($dir_fax_temp.'/'.$fax_instance_uuid.".pdf ", $dir_fax_sent.'/'.$fax_instance_uuid.".pdf");
// }
//send context to the temp log
//echo "Subject: ".$email_subject."\n";
//echo "From: ".$email_from."\n";
//echo "Reply-to: ".$email_from."\n";
//echo "To: ".$email_to."\n";
//echo "Date: ".$email_date."\n";
//echo "Transcript: ".$array['message']."\n";
//echo "Body: ".$email_body."\n";
//send email
//ob_start();
//$sent = !send_email($email_to, $email_subject, $email_body, $email_error, null, null, 3, 3, $email_attachments) ? false : true;
//$response = ob_get_clean();
//echo $response;
//save output to
//$fp = fopen(sys_get_temp_dir()."/mailer-app.log", "a");
//prepare the output buffers
//ob_end_clean();
//ob_start();
//message divider for log file
//echo "\n\n====================================================\n\n";
//get and save the output from the buffer
//$content = ob_get_contents(); //get the output from the buffer
//$content = str_replace("<br />", "", $content);
//ob_end_clean(); //clean the buffer
//fwrite($fp, $content);
//fclose($fp);
?>

66
app/fax_queue/root.php Normal file
View File

@@ -0,0 +1,66 @@
<?php
// make sure the PATH_SEPARATOR is defined
umask(2);
if (!defined("PATH_SEPARATOR")) {
if (strpos($_ENV["OS"], "Win") !== false) {
define("PATH_SEPARATOR", ";");
} else {
define("PATH_SEPARATOR", ":");
}
}
if (!isset($output_format)) $output_format = (PHP_SAPI == 'cli') ? 'text' : 'html';
// make sure the document_root is set
$_SERVER["SCRIPT_FILENAME"] = str_replace("\\", '/', $_SERVER["SCRIPT_FILENAME"]);
if(PHP_SAPI == 'cli'){
chdir(pathinfo(realpath($_SERVER["PHP_SELF"]), PATHINFO_DIRNAME));
$script_full_path = str_replace("\\", '/', getcwd() . '/' . $_SERVER["SCRIPT_FILENAME"]);
$dirs = explode('/', pathinfo($script_full_path, PATHINFO_DIRNAME));
if (file_exists('/project_root.php')) {
$path = '/';
} else {
$i = 1;
$path = '';
while ($i < count($dirs)) {
$path .= '/' . $dirs[$i];
if (file_exists($path. '/project_root.php')) {
break;
}
$i++;
}
}
$_SERVER["DOCUMENT_ROOT"] = $path;
}else{
$_SERVER["DOCUMENT_ROOT"] = str_replace($_SERVER["PHP_SELF"], "", $_SERVER["SCRIPT_FILENAME"]);
}
$_SERVER["DOCUMENT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"]);
// try to detect if a project path is being used
if (!defined('PROJECT_PATH')) {
if (is_dir($_SERVER["DOCUMENT_ROOT"]. '/fusionpbx')) {
define('PROJECT_PATH', '/fusionpbx');
} elseif (file_exists($_SERVER["DOCUMENT_ROOT"]. '/project_root.php')) {
define('PROJECT_PATH', '');
} else {
$dirs = explode('/', str_replace('\\', '/', pathinfo($_SERVER["PHP_SELF"], PATHINFO_DIRNAME)));
$i = 1;
$path = $_SERVER["DOCUMENT_ROOT"];
while ($i < count($dirs)) {
$path .= '/' . $dirs[$i];
if (file_exists($path. '/project_root.php')) {
break;
}
$i++;
}
if(!file_exists($path. '/project_root.php')){
die("Failed to locate the Project Root by searching for project_root.php please contact support for assistance");
}
$project_path = str_replace($_SERVER["DOCUMENT_ROOT"], "", $path);
define('PROJECT_PATH', $project_path);
}
$_SERVER["PROJECT_ROOT"] = realpath($_SERVER["DOCUMENT_ROOT"] . PROJECT_PATH);
set_include_path(get_include_path() . PATH_SEPARATOR . $_SERVER["PROJECT_ROOT"]);
}
?>