diff --git a/secure/fax_to_email.php b/secure/fax_to_email.php index d9d93d5508..e447b40226 100644 --- a/secure/fax_to_email.php +++ b/secure/fax_to_email.php @@ -399,39 +399,39 @@ if (!function_exists('fax_split_dtmf')) { if (isset($fax_forward_number) && !empty($fax_forward_number)) { //show info - echo "fax_forward_number: $fax_forward_number\n"; + echo "fax_forward_number: $fax_forward_number\n"; //add fax to the fax queue or send it directly - //build an array to add the fax to the queue - $array['fax_queue'][0]['fax_queue_uuid'] = uuid(); - $array['fax_queue'][0]['domain_uuid'] = $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_forward_number; - $array['fax_queue'][0]['fax_prefix'] = $fax_prefix; - $array['fax_queue'][0]['fax_email_address'] = $mail_to_address; - $array['fax_queue'][0]['fax_file'] = $fax_file; - $array['fax_queue'][0]['fax_status'] = 'waiting'; - $array['fax_queue'][0]['fax_retry_count'] = 0; - $array['fax_queue'][0]['fax_accountcode'] = $fax_accountcode; + //build an array to add the fax to the queue + $array['fax_queue'][0]['fax_queue_uuid'] = uuid(); + $array['fax_queue'][0]['domain_uuid'] = $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_forward_number; + $array['fax_queue'][0]['fax_prefix'] = $fax_prefix; + $array['fax_queue'][0]['fax_email_address'] = $mail_to_address; + $array['fax_queue'][0]['fax_file'] = $fax_file; + $array['fax_queue'][0]['fax_status'] = 'waiting'; + $array['fax_queue'][0]['fax_retry_count'] = 0; + $array['fax_queue'][0]['fax_accountcode'] = $fax_accountcode; - //add temporary permisison - $p = new permissions; - $p->add('fax_queue_add', 'temp'); + //add temporary permisison + $p = new permissions; + $p->add('fax_queue_add', 'temp'); - //save the data - $database->app_name = 'fax_queue'; - $database->app_uuid = '3656287f-4b22-4cf1-91f6-00386bf488f4'; - $database->save($array); + //save the data + $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'); + //remove temporary permisison + $p->delete('fax_queue_add', 'temp'); - //add message to show in the browser - message::add($text['confirm-queued']); + //add message to show in the browser + message::add($text['confirm-queued']); } } @@ -440,103 +440,103 @@ if (!function_exists('fax_split_dtmf')) { if (!empty($fax_email) && file_exists($fax_file)) { //get the language code - $language_code = $settings->get('domain', 'language', 'en-us'); + $language_code = $settings->get('domain', 'language', 'en-us'); //get the template subcategory - if (!empty($fax_relay) && $fax_relay == 'true') { - $template_subcategory = 'relay'; - } - else { - $template_subcategory = 'inbound'; - } + if (!empty($fax_relay) && $fax_relay == 'true') { + $template_subcategory = 'relay'; + } + else { + $template_subcategory = 'inbound'; + } //get the email template from the database - if (!empty($fax_email) && !empty($domain_uuid)) { - $sql = "select template_subject, template_body from v_email_templates "; - $sql .= "where (domain_uuid = :domain_uuid or domain_uuid is null) "; - $sql .= "and template_language = :template_language "; - $sql .= "and template_category = :template_category "; - $sql .= "and template_subcategory = :template_subcategory "; - $sql .= "and template_type = :template_type "; - $sql .= "and template_enabled = 'true' "; - $parameters['domain_uuid'] = $domain_uuid; - $parameters['template_language'] = $language_code; - $parameters['template_category'] = 'fax'; - $parameters['template_subcategory'] = $template_subcategory; - $parameters['template_type'] = 'html'; - $row = $database->select($sql, $parameters, 'row'); - if (is_array($row)) { - $email_subject = $row['template_subject']; - $email_body = $row['template_body']; - } - unset($sql, $parameters); + if (!empty($fax_email) && !empty($domain_uuid)) { + $sql = "select template_subject, template_body from v_email_templates "; + $sql .= "where (domain_uuid = :domain_uuid or domain_uuid is null) "; + $sql .= "and template_language = :template_language "; + $sql .= "and template_category = :template_category "; + $sql .= "and template_subcategory = :template_subcategory "; + $sql .= "and template_type = :template_type "; + $sql .= "and template_enabled = 'true' "; + $parameters['domain_uuid'] = $domain_uuid; + $parameters['template_language'] = $language_code; + $parameters['template_category'] = 'fax'; + $parameters['template_subcategory'] = $template_subcategory; + $parameters['template_type'] = 'html'; + $row = $database->select($sql, $parameters, 'row'); + if (is_array($row)) { + $email_subject = $row['template_subject']; + $email_body = $row['template_body']; } + unset($sql, $parameters); + } //replace variables in email subject - $email_subject = str_replace('${domain_name}', $domain_name, $email_subject); - $email_subject = str_replace('${fax_file_name}', $fax_file_name, $email_subject); - $email_subject = str_replace('${fax_extension}', $fax_extension, $email_subject); - $email_subject = str_replace('${fax_messages}', $fax_messages, $email_subject); - $email_subject = str_replace('${fax_file_warning}', $fax_file_warning, $email_subject); - $email_subject = str_replace('${fax_subject_tag}', $fax_email_inbound_subject_tag, $email_subject); + $email_subject = str_replace('${domain_name}', $domain_name, $email_subject); + $email_subject = str_replace('${fax_file_name}', $fax_file_name, $email_subject); + $email_subject = str_replace('${fax_extension}', $fax_extension, $email_subject); + $email_subject = str_replace('${fax_messages}', $fax_messages, $email_subject); + $email_subject = str_replace('${fax_file_warning}', $fax_file_warning, $email_subject); + $email_subject = str_replace('${fax_subject_tag}', $fax_email_inbound_subject_tag, $email_subject); //replace variables in email body - $email_body = str_replace('${domain_name}', $domain_name, $email_body); - $email_body = str_replace('${fax_file_name}', $fax_file_name, $email_body); - $email_body = str_replace('${fax_extension}', $fax_extension, $email_body); - $email_body = str_replace('${fax_messages}', $fax_messages, $email_body); - $email_body = str_replace('${fax_file_warning}', $fax_file_warning, $email_body); - $email_body = str_replace('${fax_subject_tag}', $fax_email_inbound_subject_tag, $email_body); + $email_body = str_replace('${domain_name}', $domain_name, $email_body); + $email_body = str_replace('${fax_file_name}', $fax_file_name, $email_body); + $email_body = str_replace('${fax_extension}', $fax_extension, $email_body); + $email_body = str_replace('${fax_messages}', $fax_messages, $email_body); + $email_body = str_replace('${fax_file_warning}', $fax_file_warning, $email_body); + $email_body = str_replace('${fax_subject_tag}', $fax_email_inbound_subject_tag, $email_body); //debug info - //echo "