Fork of FusionPBX but with LDAP kinda working
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1093 lines
44 KiB

2 years ago
  1. <?php
  2. /*
  3. FusionPBX
  4. Version: MPL 1.1
  5. The contents of this file are subject to the Mozilla Public License Version
  6. 1.1 (the "License"); you may not use this file except in compliance with
  7. the License. You may obtain a copy of the License at
  8. http://www.mozilla.org/MPL/
  9. Software distributed under the License is distributed on an "AS IS" basis,
  10. WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  11. for the specific language governing rights and limitations under the
  12. License.
  13. The Original Code is FusionPBX
  14. The Initial Developer of the Original Code is
  15. Mark J Crane <markjcrane@fusionpbx.com>
  16. Portions created by the Initial Developer are Copyright (C) 2008-2021
  17. the Initial Developer. All Rights Reserved.
  18. Contributor(s):
  19. Mark J Crane <markjcrane@fusionpbx.com>
  20. */
  21. //includes
  22. include "root.php";
  23. require_once "resources/require.php";
  24. require_once "resources/check_auth.php";
  25. //check permissions
  26. if (permission_exists('fax_extension_add') || permission_exists('fax_extension_edit') || permission_exists('fax_extension_delete')) {
  27. //access granted
  28. }
  29. else {
  30. echo "access denied";
  31. exit;
  32. }
  33. //add multi-lingual support
  34. $language = new text;
  35. $text = $language->get();
  36. //get the fax_extension and save it as a variable
  37. if (isset($_REQUEST["fax_extension"])) {
  38. $fax_extension = $_REQUEST["fax_extension"];
  39. }
  40. //set the fax directory
  41. $fax_dir = $_SESSION['switch']['storage']['dir'].'/fax/'.$_SESSION['domain_name'];
  42. //get the fax extension
  43. if (is_numeric($fax_extension) > 0) {
  44. //set the fax directories. example /usr/local/freeswitch/storage/fax/329/inbox
  45. $dir_fax_inbox = $fax_dir.'/'.$fax_extension.'/inbox';
  46. $dir_fax_sent = $fax_dir.'/'.$fax_extension.'/sent';
  47. $dir_fax_temp = $fax_dir.'/'.$fax_extension.'/temp';
  48. //make sure the directories exist
  49. if (!is_dir($_SESSION['switch']['storage']['dir'])) {
  50. mkdir($_SESSION['switch']['storage']['dir'], 0770, true);
  51. }
  52. if (!is_dir($fax_dir.'/'.$fax_extension)) {
  53. mkdir($fax_dir.'/'.$fax_extension, 0770, true);
  54. }
  55. if (!is_dir($dir_fax_inbox)) {
  56. mkdir($dir_fax_inbox, 0770, true);
  57. }
  58. if (!is_dir($dir_fax_sent)) {
  59. mkdir($dir_fax_sent, 0770, true);
  60. }
  61. if (!is_dir($dir_fax_temp)) {
  62. mkdir($dir_fax_temp, 0770, true);
  63. }
  64. }
  65. //set the action as an add or an update
  66. if (is_uuid($_REQUEST["id"])) {
  67. $action = "update";
  68. $fax_uuid = $_REQUEST["id"];
  69. $dialplan_uuid = $_REQUEST["dialplan_uuid"];
  70. }
  71. else {
  72. $action = "add";
  73. }
  74. //get the http post values and set them as php variables
  75. if (count($_POST) > 0) {
  76. //process the http post data by submitted action
  77. if ($_POST['action'] != '' && is_uuid($fax_uuid)) {
  78. $array[0]['checked'] = 'true';
  79. $array[0]['uuid'] = $fax_uuid;
  80. switch ($_POST['action']) {
  81. case 'copy':
  82. if (permission_exists('fax_extension_copy')) {
  83. $obj = new fax;
  84. $obj->copy($array);
  85. }
  86. break;
  87. case 'delete':
  88. if (permission_exists('fax_extension_delete')) {
  89. $obj = new fax;
  90. $obj->delete($array);
  91. }
  92. break;
  93. }
  94. header('Location: fax.php');
  95. exit;
  96. }
  97. //set the variables
  98. $fax_name = $_POST["fax_name"];
  99. $fax_extension = $_POST["fax_extension"];
  100. $fax_accountcode = $_POST["accountcode"];
  101. $fax_destination_number = $_POST["fax_destination_number"];
  102. $fax_prefix = $_POST["fax_prefix"];
  103. $fax_email = implode(',',array_filter($_POST["fax_email"]));
  104. $fax_email_connection_type = $_POST["fax_email_connection_type"];
  105. $fax_email_connection_host = $_POST["fax_email_connection_host"];
  106. $fax_email_connection_port = $_POST["fax_email_connection_port"];
  107. $fax_email_connection_security = $_POST["fax_email_connection_security"];
  108. $fax_email_connection_validate = $_POST["fax_email_connection_validate"];
  109. $fax_email_connection_username = $_POST["fax_email_connection_username"];
  110. $fax_email_connection_password = $_POST["fax_email_connection_password"];
  111. $fax_email_connection_mailbox = $_POST["fax_email_connection_mailbox"];
  112. $fax_email_inbound_subject_tag = $_POST["fax_email_inbound_subject_tag"];
  113. $fax_email_outbound_subject_tag = $_POST["fax_email_outbound_subject_tag"];
  114. $fax_email_outbound_authorized_senders = $_POST["fax_email_outbound_authorized_senders"];
  115. $fax_caller_id_name = $_POST["fax_caller_id_name"];
  116. $fax_caller_id_number = $_POST["fax_caller_id_number"];
  117. $fax_toll_allow = $_POST["fax_toll_allow"];
  118. $fax_forward_number = $_POST["fax_forward_number"];
  119. if (strlen($fax_destination_number) == 0) {
  120. $fax_destination_number = $fax_extension;
  121. }
  122. if (strlen($fax_forward_number) > 3) {
  123. //$fax_forward_number = preg_replace("~[^0-9]~", "",$fax_forward_number);
  124. $fax_forward_number = str_replace(" ", "", $fax_forward_number);
  125. $fax_forward_number = str_replace("-", "", $fax_forward_number);
  126. }
  127. if (strripos($fax_forward_number, '$1') === false) {
  128. $forward_prefix = ''; //not found
  129. }
  130. else {
  131. $forward_prefix = $forward_prefix.$fax_forward_number.'#'; //found
  132. }
  133. $fax_local = $_POST["fax_local"]; //! @todo check in database
  134. $fax_description = $_POST["fax_description"];
  135. $fax_send_greeting = $_POST["fax_send_greeting"];
  136. $fax_send_channels = $_POST["fax_send_channels"];
  137. //restrict size of user data
  138. $fax_name = substr($fax_name, 0, 30);
  139. $fax_extension = substr($fax_extension, 0, 15);
  140. $accountcode = substr($accountcode, 0, 80);
  141. $fax_prefix = substr($fax_prefix, 0, 12);
  142. $fax_caller_id_name = substr($fax_caller_id_name, 0, 20);
  143. $fax_caller_id_number = substr($fax_caller_id_number, 0, 20);
  144. $fax_forward_number = substr($fax_forward_number, 0, 20);
  145. }
  146. //delete the user from the fax users
  147. if (is_uuid($_REQUEST["user_uuid"]) && is_uuid($_REQUEST["id"]) && $_GET["a"] == "delete" && permission_exists("fax_extension_delete")) {
  148. //set the variables
  149. $user_uuid = $_REQUEST["user_uuid"];
  150. $fax_uuid = $_REQUEST["id"];
  151. //delete the group from the users
  152. $array['fax_users'][0]['domain_uuid'] = $_SESSION['domain_uuid'];
  153. $array['fax_users'][0]['fax_uuid'] = $fax_uuid;
  154. $array['fax_users'][0]['user_uuid'] = $user_uuid;
  155. $p = new permissions;
  156. $p->add('fax_user_delete', 'temp');
  157. $database = new database;
  158. $database->app_name = 'fax';
  159. $database->app_uuid = '24108154-4ac3-1db6-1551-4731703a4440';
  160. $database->delete($array);
  161. unset($array);
  162. $p->delete('fax_user_delete', 'temp');
  163. //redirect the browser
  164. message::add($text['message-delete']);
  165. header("Location: fax_edit.php?id=".$fax_uuid);
  166. return;
  167. }
  168. //add the user to the fax users
  169. if (is_uuid($_REQUEST["user_uuid"]) && is_uuid($_REQUEST["id"]) && $_GET["a"] != "delete") {
  170. //set the variables
  171. $user_uuid = $_REQUEST["user_uuid"];
  172. $fax_uuid = $_REQUEST["id"];
  173. //assign the user to the fax extension
  174. $array['fax_users'][0]['fax_user_uuid'] = uuid();
  175. $array['fax_users'][0]['domain_uuid'] = $_SESSION['domain_uuid'];
  176. $array['fax_users'][0]['fax_uuid'] = $fax_uuid;
  177. $array['fax_users'][0]['user_uuid'] = $user_uuid;
  178. $p = new permissions;
  179. $p->add('fax_user_add', 'temp');
  180. $database = new database;
  181. $database->app_name = 'fax';
  182. $database->app_uuid = '24108154-4ac3-1db6-1551-4731703a4440';
  183. $database->save($array);
  184. unset($array);
  185. $p->delete('fax_user_add', 'temp');
  186. //redirect the browser
  187. message::add($text['confirm-add']);
  188. header("Location: fax_edit.php?id=".$fax_uuid);
  189. return;
  190. }
  191. //clear file status cache
  192. clearstatcache();
  193. //process the data
  194. if (count($_POST) > 0 && strlen($_POST["persistformvar"]) == 0) {
  195. $msg = '';
  196. if ($action == "update" && is_uuid($_POST["fax_uuid"]) && permission_exists('fax_extension_edit')) {
  197. $fax_uuid = $_POST["fax_uuid"];
  198. }
  199. //validate the token
  200. $token = new token;
  201. if (!$token->validate($_SERVER['PHP_SELF'])) {
  202. message::add($text['message-invalid_token'],'negative');
  203. header('Location: fax.php');
  204. exit;
  205. }
  206. //check for all required data
  207. if (strlen($fax_extension) == 0) { $msg .= "".$text['confirm-ext']."<br>\n"; }
  208. if (strlen($fax_name) == 0) { $msg .= "".$text['confirm-fax']."<br>\n"; }
  209. if (strlen($msg) > 0 && strlen($_POST["persistformvar"]) == 0) {
  210. require_once "resources/header.php";
  211. require_once "resources/persist_form_var.php";
  212. echo "<div align='center'>\n";
  213. echo "<table><tr><td>\n";
  214. echo $msg."<br />";
  215. echo "</td></tr></table>\n";
  216. persistformvar($_POST);
  217. echo "</div>\n";
  218. require_once "resources/footer.php";
  219. return;
  220. }
  221. //sanitize the fax extension number
  222. $fax_extension = preg_replace('#[^0-9]#', '', $fax_extension);
  223. //replace the spaces with a dash
  224. $fax_name = str_replace(" ", "-", $fax_name);
  225. //escape the commas with a backslash and remove the spaces
  226. $fax_email = str_replace(" ", "", $fax_email);
  227. //set the $php_bin
  228. //if (file_exists(PHP_BINDIR."/php")) { $php_bin = 'php'; }
  229. if (substr(strtoupper(PHP_OS), 0, 3) == "WIN") {
  230. $php_bin = 'php.exe';
  231. }
  232. elseif (file_exists(PHP_BINDIR."/php5")) {
  233. $php_bin = 'php5';
  234. }
  235. else {
  236. $php_bin = 'php';
  237. }
  238. //add or update the database
  239. if ($_POST["persistformvar"] != "true") {
  240. //prep authorized senders
  241. if (sizeof($fax_email_outbound_authorized_senders) > 0) {
  242. foreach ($fax_email_outbound_authorized_senders as $sender_num => $sender) {
  243. if ($sender == '' || (substr_count($sender, '@') == 1 && !valid_email($sender)) || substr_count($sender, '.') == 0) {
  244. unset($fax_email_outbound_authorized_senders[$sender_num]);
  245. }
  246. }
  247. $fax_email_outbound_authorized_senders = strtolower(implode(',', $fax_email_outbound_authorized_senders));
  248. }
  249. if ($action == "add" && permission_exists('fax_extension_add')) {
  250. //prepare the unique identifiers
  251. $fax_uuid = uuid();
  252. $dialplan_uuid = uuid();
  253. //begin insert array
  254. $array['fax'][0]['fax_uuid'] = $fax_uuid;
  255. $array['fax'][0]['dialplan_uuid'] = $dialplan_uuid;
  256. //assign temp permission
  257. $p = new permissions;
  258. $p->add('fax_add', 'temp');
  259. //set the dialplan action
  260. $dialplan_type = "add";
  261. }
  262. if ($action == "update" && permission_exists('fax_extension_edit')) {
  263. //begin update array
  264. $array['fax'][0]['fax_uuid'] = $fax_uuid;
  265. //assign temp permission
  266. $p = new permissions;
  267. $p->add('fax_edit', 'temp');
  268. }
  269. if (is_array($array) && @sizeof($array) != 0) {
  270. //add common columns to array
  271. $array['fax'][0]['domain_uuid'] = $_SESSION['domain_uuid'];
  272. $array['fax'][0]['fax_extension'] = $fax_extension;
  273. $array['fax'][0]['accountcode'] = $fax_accountcode;
  274. $array['fax'][0]['fax_destination_number'] = $fax_destination_number;
  275. $array['fax'][0]['fax_prefix'] = $fax_prefix;
  276. $array['fax'][0]['fax_name'] = $fax_name;
  277. $array['fax'][0]['fax_email'] = $fax_email;
  278. if (permission_exists('fax_extension_advanced') && function_exists("imap_open") && file_exists("fax_files_remote.php")) {
  279. $array['fax'][0]['fax_email_connection_type'] = $fax_email_connection_type;
  280. $array['fax'][0]['fax_email_connection_host'] = $fax_email_connection_host;
  281. $array['fax'][0]['fax_email_connection_port'] = $fax_email_connection_port;
  282. $array['fax'][0]['fax_email_connection_security'] = $fax_email_connection_security;
  283. $array['fax'][0]['fax_email_connection_validate'] = $fax_email_connection_validate;
  284. $array['fax'][0]['fax_email_connection_username'] = $fax_email_connection_username;
  285. $array['fax'][0]['fax_email_connection_password'] = $fax_email_connection_password;
  286. $array['fax'][0]['fax_email_connection_mailbox'] = $fax_email_connection_mailbox;
  287. $array['fax'][0]['fax_email_inbound_subject_tag'] = $fax_email_inbound_subject_tag;
  288. $array['fax'][0]['fax_email_outbound_subject_tag'] = $fax_email_outbound_subject_tag;
  289. $array['fax'][0]['fax_email_outbound_authorized_senders'] = $fax_email_outbound_authorized_senders;
  290. }
  291. $array['fax'][0]['fax_caller_id_name'] = $fax_caller_id_name;
  292. $array['fax'][0]['fax_caller_id_number'] = $fax_caller_id_number;
  293. $array['fax'][0]['fax_toll_allow'] = $fax_toll_allow;
  294. if ($action == "add" && strlen($fax_forward_number) > 0) {
  295. $array['fax'][0]['fax_forward_number'] = $fax_forward_number;
  296. }
  297. if ($action == "update") {
  298. $array['fax'][0]['fax_forward_number'] = strlen($fax_forward_number) > 0 ? $fax_forward_number : null;
  299. }
  300. if (permission_exists('fax_send_greeting')) {
  301. $array['fax'][0]['fax_send_greeting'] = strlen($fax_send_greeting) != 0 ? $fax_send_greeting : null;
  302. }
  303. $array['fax'][0]['fax_send_channels'] = strlen($fax_send_channels) != 0 ? $fax_send_channels : null;
  304. $array['fax'][0]['fax_description'] = $fax_description;
  305. //execute
  306. $database = new database;
  307. $database->app_name = 'fax';
  308. $database->app_uuid = '24108154-4ac3-1db6-1551-4731703a4440';
  309. $database->save($array);
  310. unset($array);
  311. //revoke temp permissions
  312. $p->delete('fax_add', 'temp');
  313. $p->delete('fax_edit', 'temp');
  314. //clear the destinations session array
  315. if (isset($_SESSION['destinations']['array'])) {
  316. unset($_SESSION['destinations']['array']);
  317. }
  318. }
  319. //get the dialplan_uuid
  320. $sql = "select dialplan_uuid from v_fax ";
  321. $sql .= "where domain_uuid = :domain_uuid ";
  322. $sql .= "and fax_uuid = :fax_uuid ";
  323. $parameters['domain_uuid'] = $_SESSION['domain_uuid'];
  324. $parameters['fax_uuid'] = $fax_uuid;
  325. $database = new database;
  326. $dialplan_uuid = $database->select($sql, $parameters, 'column');
  327. unset($sql, $parameters);
  328. //dialplan add or update
  329. $c = new fax;
  330. $c->db = $db;
  331. $c->domain_uuid = $_SESSION['domain_uuid'];
  332. $c->dialplan_uuid = $dialplan_uuid;
  333. $c->fax_name = $fax_name;
  334. $c->fax_uuid = $fax_uuid;
  335. $c->fax_extension = $fax_extension;
  336. $c->fax_forward_number = $fax_forward_number;
  337. $c->destination_number = $fax_destination_number;
  338. $c->fax_description = $fax_description;
  339. $a = $c->dialplan();
  340. //redirect the browser
  341. if ($action == "update" && permission_exists('fax_extension_edit')) {
  342. message::add($text['confirm-update']);
  343. }
  344. if ($action == "add" && permission_exists('fax_extension_add')) {
  345. message::add($text['confirm-add']);
  346. }
  347. header("Location: fax.php");
  348. return;
  349. }
  350. }
  351. //pre-populate the form
  352. if (is_uuid($_GET['id']) && $_POST["persistformvar"] != "true") {
  353. $fax_uuid = $_GET["id"];
  354. $sql = "select * from v_fax ";
  355. $sql .= "where domain_uuid = :domain_uuid ";
  356. $sql .= "and fax_uuid = :fax_uuid ";
  357. $parameters['domain_uuid'] = $_SESSION['domain_uuid'];
  358. $parameters['fax_uuid'] = $fax_uuid;
  359. $database = new database;
  360. $row = $database->select($sql, $parameters, 'row');
  361. if (is_array($row) && @sizeof($row) != 0) {
  362. $dialplan_uuid = $row["dialplan_uuid"];
  363. $fax_extension = $row["fax_extension"];
  364. $fax_accountcode = $row["accountcode"];
  365. $fax_destination_number = $row["fax_destination_number"];
  366. $fax_prefix = $row["fax_prefix"];
  367. $fax_name = $row["fax_name"];
  368. $fax_email = $row["fax_email"];
  369. $fax_email_connection_type = $row["fax_email_connection_type"];
  370. $fax_email_connection_host = $row["fax_email_connection_host"];
  371. $fax_email_connection_port = $row["fax_email_connection_port"];
  372. $fax_email_connection_security = $row["fax_email_connection_security"];
  373. $fax_email_connection_validate = $row["fax_email_connection_validate"];
  374. $fax_email_connection_username = $row["fax_email_connection_username"];
  375. $fax_email_connection_password = $row["fax_email_connection_password"];
  376. $fax_email_connection_mailbox = $row["fax_email_connection_mailbox"];
  377. $fax_email_inbound_subject_tag = $row["fax_email_inbound_subject_tag"];
  378. $fax_email_outbound_subject_tag = $row["fax_email_outbound_subject_tag"];
  379. $fax_email_outbound_authorized_senders = $row["fax_email_outbound_authorized_senders"];
  380. $fax_caller_id_name = $row["fax_caller_id_name"];
  381. $fax_caller_id_number = $row["fax_caller_id_number"];
  382. $fax_toll_allow = $row["fax_toll_allow"];
  383. $fax_forward_number = $row["fax_forward_number"];
  384. $fax_description = $row["fax_description"];
  385. $fax_send_greeting = $row["fax_send_greeting"];
  386. $fax_send_channels = $row["fax_send_channels"];
  387. }
  388. unset($sql, $parameters, $row);
  389. }
  390. else{
  391. $fax_send_channels = 10;
  392. }
  393. //get the fax users
  394. $sql = "select * from v_fax_users as e, v_users as u ";
  395. $sql .= "where e.user_uuid = u.user_uuid ";
  396. $sql .= "and e.domain_uuid = :domain_uuid ";
  397. $sql .= "and e.fax_uuid = :fax_uuid ";
  398. $parameters['domain_uuid'] = $_SESSION['domain_uuid'];
  399. $parameters['fax_uuid'] = $fax_uuid;
  400. $database = new database;
  401. $fax_users = $database->select($sql, $parameters, 'all');
  402. unset($sql, $parameters);
  403. //get the users that are not assigned to this fax server
  404. $sql = "select * from v_users \n";
  405. $sql .= "where domain_uuid = :domain_uuid \n";
  406. $sql .= "and user_uuid not in (\n";
  407. $sql .= " select user_uuid from v_fax_users ";
  408. $sql .= " where domain_uuid = :domain_uuid ";
  409. $sql .= " and fax_uuid = :fax_uuid ";
  410. $sql .= " and user_uuid is not null ";
  411. $sql .= ")\n";
  412. $parameters['domain_uuid'] = $_SESSION['domain_uuid'];
  413. $parameters['fax_uuid'] = $fax_uuid;
  414. $database = new database;
  415. $available_users = $database->select($sql, $parameters, 'all');
  416. unset($sql, $parameters);
  417. //replace the dash with a space
  418. $fax_name = str_replace("-", " ", $fax_name);
  419. //build the fax_emails array
  420. $fax_emails = explode(',',$fax_email);
  421. //set the dialplan_uuid
  422. if (!is_uuid($dialplan_uuid)) {
  423. $dialplan_uuid = uuid();
  424. }
  425. //create token
  426. $object = new token;
  427. $token = $object->create($_SERVER['PHP_SELF']);
  428. //show the header
  429. $document['title'] = $text['title-fax_server_settings'];
  430. require_once "resources/header.php";
  431. //advanced button js
  432. echo "<script type='text/javascript' language='JavaScript'>\n";
  433. echo " function toggle_advanced(advanced_id) {\n";
  434. echo " $('#'+advanced_id).toggle();\n";
  435. echo " if ($('#'+advanced_id).is(':visible')) {\n";
  436. echo " $('html, body').animate({scrollTop: $('#'+advanced_id).offset().top - 80}, 'slow');\n";
  437. echo " }\n";
  438. echo " }\n";
  439. echo " function add_sender() {\n";
  440. echo " var newdiv = document.createElement('div');\n";
  441. echo " newdiv.innerHTML = \"<input type='text' class='formfld' style='width: 225px; min-width: 225px; max-width: 225px; margin-top: 3px;' name='fax_email_outbound_authorized_senders[]' maxlength='255'>\";";
  442. echo " document.getElementById('authorized_senders').appendChild(newdiv);";
  443. echo " }\n";
  444. echo "</script>\n";
  445. //show the content
  446. echo "<form method='post' name='frm' id='frm'>\n";
  447. echo "<div class='action_bar' id='action_bar'>\n";
  448. echo " <div class='heading'><b>".$text['header-fax_server_settings']."</b></div>\n";
  449. echo " <div class='actions'>\n";
  450. echo button::create(['type'=>'button','label'=>$text['button-back'],'icon'=>$_SESSION['theme']['button_icon_back'],'id'=>'btn_back','link'=>'fax.php']);
  451. if ($action == "update") {
  452. $button_margin = 'margin-left: 15px;';
  453. if (permission_exists('fax_extension_copy')) {
  454. echo button::create(['type'=>'button','label'=>$text['button-copy'],'icon'=>$_SESSION['theme']['button_icon_copy'],'name'=>'btn_copy','style'=>$button_margin,'onclick'=>"modal_open('modal-copy','btn_copy');"]);
  455. unset($button_margin);
  456. }
  457. if (permission_exists('fax_extension_delete')) {
  458. echo button::create(['type'=>'button','label'=>$text['button-delete'],'icon'=>$_SESSION['theme']['button_icon_delete'],'name'=>'btn_delete','style'=>$button_margin,'onclick'=>"modal_open('modal-delete','btn_delete');"]);
  459. unset($button_margin);
  460. }
  461. }
  462. echo button::create(['type'=>'submit','label'=>$text['button-save'],'icon'=>$_SESSION['theme']['button_icon_save'],'id'=>'btn_save','style'=>'margin-left: 15px;']);
  463. echo " </div>\n";
  464. echo " <div style='clear: both;'></div>\n";
  465. echo "</div>\n";
  466. if ($action == 'update') {
  467. if (permission_exists('fax_extension_copy')) {
  468. 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();"])]);
  469. }
  470. if (permission_exists('fax_extension_delete')) {
  471. 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();"])]);
  472. }
  473. }
  474. echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
  475. if (!permission_exists('fax_extension_delete')) {
  476. echo "<tr>\n";
  477. echo "<td width='30%' class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
  478. echo " ".$text['label-email']."\n";
  479. echo "</td>\n";
  480. echo "<td width='70%' class='vtable' align='left'>\n";
  481. echo " <input class='formfld' type='email' name='fax_email' maxlength='255' value=\"".escape($fax_email)."\">\n";
  482. echo "<br />\n";
  483. echo " ".$text['description-email']."\n";
  484. echo "</td>\n";
  485. echo "</tr>\n";
  486. }
  487. else { //admin, superadmin, etc
  488. echo "<tr>\n";
  489. echo "<td width='30%' class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
  490. echo " ".$text['label-name']."\n";
  491. echo "</td>\n";
  492. echo "<td width='70%' class='vtable' align='left'>\n";
  493. echo " <input class='formfld' type='text' name='fax_name' maxlength='30' value=\"".escape($fax_name)."\" required='required'>\n";
  494. echo "<br />\n";
  495. echo "".$text['description-name']."\n";
  496. echo "</td>\n";
  497. echo "</tr>\n";
  498. echo "<tr>\n";
  499. echo "<td class='vncellreq' valign='top' align='left' nowrap='nowrap'>\n";
  500. echo " ".$text['label-extension']."\n";
  501. echo "</td>\n";
  502. echo "<td class='vtable' align='left'>\n";
  503. echo " <input class='formfld' type='text' name='fax_extension' maxlength='15' value=\"".escape($fax_extension)."\" required='required'>\n";
  504. echo "<br />\n";
  505. echo "".$text['description-extension']."\n";
  506. echo "</td>\n";
  507. echo "</tr>\n";
  508. echo "<tr>\n";
  509. echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
  510. echo " ".$text['label-accountcode']."\n";
  511. echo "</td>\n";
  512. echo "<td class='vtable' align='left'>\n";
  513. if ($action == "add") { $fax_accountcode = get_accountcode(); }
  514. echo " <input class='formfld' type='text' name='accountcode' maxlength='80' value=\"".escape($fax_accountcode)."\">\n";
  515. echo "<br />\n";
  516. echo $text['description-accountcode']."\n";
  517. echo "</td>\n";
  518. echo "</tr>\n";
  519. echo "<tr>\n";
  520. echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
  521. echo " ".$text['label-destination-number']."\n";
  522. echo "</td>\n";
  523. echo "<td class='vtable' align='left'>\n";
  524. echo " <input class='formfld' type='text' name='fax_destination_number' maxlength='255' value=\"".escape($fax_destination_number)."\">\n";
  525. echo "<br />\n";
  526. echo " ".$text['description-destination-number']."\n";
  527. echo "</td>\n";
  528. echo "</tr>\n";
  529. echo "<tr>\n";
  530. echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
  531. echo " ".$text['label-fax_prefix']."\n";
  532. echo "</td>\n";
  533. echo "<td class='vtable' align='left'>\n";
  534. echo " <input class='formfld' type='text' name='fax_prefix' maxlength='12' value=\"".escape($fax_prefix)."\">\n";
  535. echo "<br />\n";
  536. echo " ".$text['description-fax_prefix']."\n";
  537. echo "</td>\n";
  538. echo "</tr>\n";
  539. echo "<tr>\n";
  540. echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
  541. echo " ".$text['label-email']."\n";
  542. echo "</td>\n";
  543. echo "<td class='vtable' align='left'>\n";
  544. echo "<table border='0' cellpadding='2' cellspacing='0'>\n";
  545. $x = 0;
  546. foreach($fax_emails as $email) {
  547. echo "<tr>\n";
  548. echo "<td>\n";
  549. echo " <input class='formfld' type=\"text\" name=\"fax_email[".$x."]\" maxlength='255' style=\"width: 90%;\"value=\"".escape($email)."\">\n";
  550. echo "</td>\n";
  551. $x++;
  552. }
  553. echo "<tr>\n";
  554. echo " <td>\n";
  555. echo " <input class='formfld' type=\"text\" name=\"fax_email[".$x++."]\" maxlength='255' style=\"width: 90%;\"value=\"\">\n";
  556. echo " </td>\n";
  557. echo "</table>\n";
  558. echo " ".$text['description-email']."\n";
  559. if (permission_exists('fax_extension_advanced') && function_exists("imap_open") && file_exists("fax_files_remote.php")) {
  560. echo "<br /><br />\n";
  561. echo button::create(['type'=>'button','label'=>$text['button-advanced'],'icon'=>'tools','onclick'=>"toggle_advanced('advanced_email_connection');"]);
  562. }
  563. echo "<br />\n";
  564. echo "</td>\n";
  565. echo "</tr>\n";
  566. echo "<tr>\n";
  567. echo "<td width='30%' class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
  568. echo " ".$text['label-caller-id-name']."\n";
  569. echo "</td>\n";
  570. echo "<td width='70%' class='vtable' align='left'>\n";
  571. echo " <input class='formfld' type='text' name='fax_caller_id_name' maxlength='20' value=\"".escape($fax_caller_id_name)."\">\n";
  572. echo "<br />\n";
  573. echo "".$text['description-caller-id-name']."\n";
  574. echo "</td>\n";
  575. echo "</tr>\n";
  576. echo "<tr>\n";
  577. echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
  578. echo " ".$text['label-caller-id-number']."\n";
  579. echo "</td>\n";
  580. echo "<td class='vtable' align='left'>\n";
  581. echo " <input class='formfld' type='text' name='fax_caller_id_number' maxlength='20' min='0' step='1' value=\"".escape($fax_caller_id_number)."\">\n";
  582. echo "<br />\n";
  583. echo "".$text['description-caller-id-number']."\n";
  584. echo "</td>\n";
  585. echo "</tr>\n";
  586. echo "<tr>\n";
  587. echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
  588. echo " ".$text['label-forward']."\n";
  589. echo "</td>\n";
  590. echo "<td class='vtable' align='left'>\n";
  591. echo " <input class='formfld' type='text' name='fax_forward_number' maxlength='20' value=\"".((is_numeric($fax_forward_number)) ? format_phone($fax_forward_number) : escape($fax_forward_number))."\">\n";
  592. echo "<br />\n";
  593. echo "".$text['description-forward-number']."\n";
  594. echo "</td>\n";
  595. echo "</tr>\n";
  596. echo "<tr>\n";
  597. echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
  598. echo " ".$text['label-toll_allow']."\n";
  599. echo "</td>\n";
  600. echo "<td class='vtable' align='left'>\n";
  601. echo " <input class='formfld' type='text' name='fax_toll_allow' maxlength='20' min='0' step='1' value=\"".escape($fax_toll_allow)."\">\n";
  602. echo "<br />\n";
  603. echo "".$text['description-toll_allow']."\n";
  604. echo "</td>\n";
  605. echo "</tr>\n";
  606. if (permission_exists('fax_user_view')) {
  607. if ($action == "update") {
  608. echo " <tr>";
  609. echo " <td class='vncell' valign='top'>".$text['label-user-list']."</td>";
  610. echo " <td class='vtable'>";
  611. if (is_array($fax_users) && @sizeof($fax_users) != 0) {
  612. echo " <table style='width: 50%; min-width: 200px; max-width: 450px;'>\n";
  613. foreach($fax_users as $field) {
  614. echo " <tr>\n";
  615. echo " <td class='vtable'>".escape($field['username'])."</td>\n";
  616. echo " <td>\n";
  617. echo " <a href='fax_edit.php?id=".urlencode($fax_uuid)."&domain_uuid=".urlencode($_SESSION['domain_uuid'])."&user_uuid=".urlencode($field['user_uuid'])."&a=delete' alt='delete' onclick=\"return confirm('".$text['confirm-delete']."')\">$v_link_label_delete</a>\n";
  618. echo " </td>\n";
  619. echo " </tr>\n";
  620. }
  621. echo " </table>\n";
  622. echo " <br />\n";
  623. }
  624. unset($fax_users);
  625. if (is_array($available_users) && @sizeof($available_users) != 0) {
  626. echo " <select name='user_uuid' class='formfld' style='width: auto;'>\n";
  627. echo " <option value=''></option>\n";
  628. foreach($available_users as $field) {
  629. echo " <option value='".escape($field['user_uuid'])."'>".escape($field['username'])."</option>\n";
  630. }
  631. echo " </select>";
  632. echo button::create(['type'=>'submit','label'=>$text['button-add'],'icon'=>$_SESSION['theme']['button_icon_add']]);
  633. echo " <br>\n";
  634. echo " ".$text['description-user-add']."\n";
  635. echo " <br />\n";
  636. unset($available_users);
  637. }
  638. echo " </td>";
  639. echo " </tr>";
  640. }
  641. }
  642. if (permission_exists('fax_send_greeting')) {
  643. echo "<tr>\n";
  644. echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
  645. echo " ".$text['label-fax_send_greeting']."\n";
  646. echo "</td>\n";
  647. echo "<td class='vtable' align='left'>\n";
  648. if (permission_exists('fax_extension_add') || permission_exists('fax_extension_edit')) {
  649. echo "<script>\n";
  650. echo "var Objs;\n";
  651. echo "\n";
  652. echo "function changeToInput(obj){\n";
  653. echo " tb=document.createElement('INPUT');\n";
  654. echo " tb.type='text';\n";
  655. echo " tb.name=obj.name;\n";
  656. echo " tb.setAttribute('class', 'formfld');\n";
  657. echo " tb.setAttribute('style', 'width: 350px;');\n";
  658. echo " tb.value=obj.options[obj.selectedIndex].value;\n";
  659. echo " tbb=document.createElement('INPUT');\n";
  660. echo " tbb.setAttribute('class', 'btn');\n";
  661. echo " tbb.setAttribute('style', 'margin-left: 4px;');\n";
  662. echo " tbb.type='button';\n";
  663. echo " tbb.value=$('<div />').html('&#9665;').text();\n";
  664. echo " tbb.objs=[obj,tb,tbb];\n";
  665. echo " tbb.onclick=function(){ Replace(this.objs); }\n";
  666. echo " obj.parentNode.insertBefore(tb,obj);\n";
  667. echo " obj.parentNode.insertBefore(tbb,obj);\n";
  668. echo " obj.parentNode.removeChild(obj);\n";
  669. echo "}\n";
  670. echo "\n";
  671. echo "function Replace(obj){\n";
  672. echo " obj[2].parentNode.insertBefore(obj[0],obj[2]);\n";
  673. echo " obj[0].parentNode.removeChild(obj[1]);\n";
  674. echo " obj[0].parentNode.removeChild(obj[2]);\n";
  675. echo "}\n";
  676. echo "</script>\n";
  677. echo "\n";
  678. }
  679. echo " <select name='fax_send_greeting' class='formfld' ".((permission_exists('fax_extension_add') || permission_exists('fax_extension_edit')) ? "onchange='changeToInput(this);'" : null).">\n";
  680. echo " <option></option>\n";
  681. //recordings
  682. if($dh = opendir($_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/")) {
  683. $tmp_selected = false;
  684. $files = Array();
  685. echo "<optgroup label='Recordings'>\n";
  686. while ($file = readdir($dh)) {
  687. if ($file != "." && $file != ".." && $file[0] != '.') {
  688. if (!is_dir($_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$file)) {
  689. $selected = ($fax_send_greeting == $_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$file && strlen($fax_send_greeting) > 0) ? true : false;
  690. echo " <option value='".escape($_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$file)."' ".(($selected) ? "selected='selected'" : null).">".escape($file)."</option>\n";
  691. if ($selected) { $tmp_selected = true; }
  692. }
  693. }
  694. }
  695. closedir($dh);
  696. echo "</optgroup>\n";
  697. }
  698. //phrases
  699. $sql = "select * from v_phrases where domain_uuid = :domain_uuid ";
  700. $parameters['domain_uuid'] = $domain_uuid;
  701. $database = new database;
  702. $result = $database->select($sql, $parameters, 'all');
  703. if (is_array($array) && @sizeof($array) != 0) {
  704. echo "<optgroup label='Phrases'>\n";
  705. foreach ($result as &$row) {
  706. $selected = ($fax_send_greeting == "phrase:".$row["phrase_uuid"]) ? true : false;
  707. echo " <option value='phrase:".escape($row["phrase_uuid"])."' ".(($selected) ? "selected='selected'" : null).">".escape($row["phrase_name"])."</option>\n";
  708. if ($selected) { $tmp_selected = true; }
  709. }
  710. echo "</optgroup>\n";
  711. }
  712. unset($sql, $parameters, $result, $row);
  713. //sounds
  714. $file = new file;
  715. $sound_files = $file->sounds();
  716. if (is_array($sound_files)) {
  717. echo "<optgroup label='Sounds'>\n";
  718. foreach ($sound_files as $value) {
  719. if (strlen($value) > 0) {
  720. if (substr($fax_send_greeting, 0, 71) == "\$\${sounds_dir}/\${default_language}/\${default_dialect}/\${default_voice}/") {
  721. $fax_send_greeting = substr($fax_send_greeting, 71);
  722. }
  723. $selected = ($fax_send_greeting == $value) ? true : false;
  724. echo " <option value='".escape($value)."' ".(($selected) ? "selected='selected'" : null).">".escape($value)."</option>\n";
  725. if ($selected) { $tmp_selected = true; }
  726. }
  727. }
  728. echo "</optgroup>\n";
  729. }
  730. //select
  731. if (strlen($fax_send_greeting) > 0) {
  732. if (permission_exists('conference_center_add') || permission_exists('conference_center_edit')) {
  733. if (!$tmp_selected) {
  734. echo "<optgroup label='selected'>\n";
  735. if (file_exists($_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$fax_send_greeting)) {
  736. echo " <option value='".escape($_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/".$fax_send_greeting)."' selected='selected'>".escape($ivr_menu_greet_long)."</option>\n";
  737. }
  738. else if (substr($fax_send_greeting, -3) == "wav" || substr($fax_send_greeting, -3) == "mp3") {
  739. echo " <option value='".escape($fax_send_greeting)."' selected='selected'>".escape($fax_send_greeting)."</option>\n";
  740. }
  741. else {
  742. echo " <option value='".escape($fax_send_greeting)."' selected='selected'>".escape($fax_send_greeting)."</option>\n";
  743. }
  744. echo "</optgroup>\n";
  745. }
  746. unset($tmp_selected);
  747. }
  748. }
  749. echo " </select>\n";
  750. echo "<br />\n";
  751. echo " ".$text['description-fax_send_greeting']."\n";
  752. echo "</td>\n";
  753. echo "</tr>\n";
  754. }
  755. echo "<tr>\n";
  756. echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
  757. echo " ".$text['label-fax_send_channels']."\n";
  758. echo "</td>\n";
  759. echo "<td class='vtable' align='left'>\n";
  760. echo " <input class='formfld' type='text' name='fax_send_channels' maxlength='255' value=\"".escape($fax_send_channels)."\">\n";
  761. echo "<br />\n";
  762. echo " ".$text['description-fax_send_channels']."\n";
  763. echo "</td>\n";
  764. echo "</tr>\n";
  765. echo "<tr>\n";
  766. echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
  767. echo " ".$text['label-description']."\n";
  768. echo "</td>\n";
  769. echo "<td class='vtable' align='left'>\n";
  770. echo " <input class='formfld' type='text' name='fax_description' maxlength='255' value=\"".escape($fax_description)."\">\n";
  771. echo "<br />\n";
  772. echo "".$text['description-info']."\n";
  773. echo "</td>\n";
  774. echo "</tr>\n";
  775. }
  776. echo " <tr>\n";
  777. echo " <td colspan='2' align='right'>\n";
  778. echo " <br>";
  779. if ($action == "update") {
  780. if (!permission_exists('fax_extension_delete')) {
  781. echo " <input type='hidden' name='fax_name' value=\"".escape($fax_name)."\">\n";
  782. echo " <input type='hidden' name='fax_extension' value=\"".escape($fax_extension)."\">\n";
  783. echo " <input type='hidden' name='fax_destination_number' value=\"".escape($fax_destination_number)."\">\n";
  784. echo " <input type='hidden' name='fax_caller_id_name' value=\"".escape($fax_caller_id_name)."\">\n";
  785. echo " <input type='hidden' name='fax_caller_id_number' value=\"".escape($fax_caller_id_number)."\">\n";
  786. echo " <input type='hidden' name='fax_forward_number' value=\"".((is_numeric($fax_forward_number)) ? format_phone($fax_forward_number) : escape($fax_forward_number))."\">\n";
  787. echo " <input type='hidden' name='fax_description' value=\"".escape($fax_description)."\">\n";
  788. }
  789. echo " <input type='hidden' name='fax_uuid' value='".escape($fax_uuid)."'>\n";
  790. echo " <input type='hidden' name='dialplan_uuid' value='".escape($dialplan_uuid)."'>\n";
  791. }
  792. echo " <input type='hidden' name='".$token['name']."' value='".$token['hash']."'>\n";
  793. echo " </td>\n";
  794. echo " </tr>";
  795. echo "</table>";
  796. echo "<br />\n";
  797. if (permission_exists('fax_extension_advanced') && function_exists("imap_open") && file_exists("fax_files_remote.php")) {
  798. echo "<div id='advanced_email_connection' ".(($fax_email_connection_host == '') ? "style='display: none;'" : null).">\n";
  799. echo "<div class='action_bar sub'>\n";
  800. echo " <div class='heading'><b>".$text['label-advanced_settings']."</b></div>\n";
  801. echo " <div class='actions'>\n";
  802. echo " </div>\n";
  803. echo " <div style='clear: both;'></div>\n";
  804. echo "</div>\n";
  805. echo $text['description-advanced_settings']."\n";
  806. echo "<br><br>\n";
  807. echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
  808. echo " <tr>";
  809. echo " <td width='50%' valign='top'>";
  810. echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
  811. echo "<tr>";
  812. echo "<td colspan='2'>";
  813. echo " <span style='font-weight: bold; color: #000;'>".$text['label-email_account_connection']."</span><br><br>";
  814. echo "</td>";
  815. echo "</tr>\n";
  816. echo "<tr>\n";
  817. echo "<td width='30%' class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
  818. echo " ".$text['label-email_connection_type']."\n";
  819. echo "</td>\n";
  820. echo "<td width='70%' class='vtable' align='left'>\n";
  821. echo " <select class='formfld' name='fax_email_connection_type'>\n";
  822. echo " <option value='imap'>IMAP</option>\n";
  823. echo " <option value='pop3' ".(($fax_email_connection_type == 'pop3') ? "selected" : null).">POP3</option>\n";
  824. echo " </select>\n";
  825. echo "<br />\n";
  826. echo " ".$text['description-email_connection_type']."\n";
  827. echo "</td>\n";
  828. echo "</tr>\n";
  829. echo "<tr>\n";
  830. echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
  831. echo " ".$text['label-email_connection_server']."\n";
  832. echo "</td>\n";
  833. echo "<td class='vtable' style='white-space: nowrap;' align='left'>\n";
  834. echo " <input class='formfld' type='text' name='fax_email_connection_host' maxlength='255' value=\"".escape($fax_email_connection_host)."\">&nbsp;<strong style='font-size: 15px;'>:</strong>&nbsp;";
  835. echo "<input class='formfld' style='width: 50px; min-width: 50px; max-width: 50px;' type='text' name='fax_email_connection_port' maxlength='5' value=\"$fax_email_connection_port\">\n";
  836. echo "<br />\n";
  837. echo " ".$text['description-email_connection_server']."\n";
  838. echo "</td>\n";
  839. echo "</tr>\n";
  840. echo "<tr>\n";
  841. echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
  842. echo " ".$text['label-email_connection_security']."\n";
  843. echo "</td>\n";
  844. echo "<td class='vtable' align='left'>\n";
  845. echo " <select class='formfld' name='fax_email_connection_security'>\n";
  846. echo " <option value=''></option>\n";
  847. echo " <option value='ssl' ".(($fax_email_connection_security == 'ssl') ? "selected" : null).">SSL</option>\n";
  848. echo " <option value='tls' ".(($fax_email_connection_security == 'tls') ? "selected" : null).">TLS</option>\n";
  849. echo " </select>\n";
  850. echo "<br />\n";
  851. echo " ".$text['description-email_connection_security']."\n";
  852. echo "</td>\n";
  853. echo "</tr>\n";
  854. echo "<tr>\n";
  855. echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
  856. echo " ".$text['label-email_connection_validate']."\n";
  857. echo "</td>\n";
  858. echo "<td class='vtable' align='left'>\n";
  859. echo " <select class='formfld' name='fax_email_connection_validate'>\n";
  860. echo " <option value='true'>".$text['option-true']."</option>\n";
  861. echo " <option value='false' ".(($fax_email_connection_validate == 'false') ? "selected" : null).">".$text['option-false']."</option>\n";
  862. echo " </select>\n";
  863. echo "<br />\n";
  864. echo " ".$text['description-email_connection_validate']."\n";
  865. echo "</td>\n";
  866. echo "</tr>\n";
  867. echo "<tr>\n";
  868. echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
  869. echo " ".$text['label-email_connection_username']."\n";
  870. echo "</td>\n";
  871. echo "<td class='vtable' align='left'>\n";
  872. echo " <input class='formfld' type='text' name='fax_email_connection_username' maxlength='255' value=\"".escape($fax_email_connection_username)."\">\n";
  873. echo " <input type='text' style='display: none;' disabled='disabled'>\n"; //help defeat browser auto-fill
  874. echo "<br />\n";
  875. echo " ".$text['description-email_connection_username']."\n";
  876. echo "</td>\n";
  877. echo "</tr>\n";
  878. echo "<tr>\n";
  879. echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
  880. echo " ".$text['label-email_connection_password']."\n";
  881. echo "</td>\n";
  882. echo "<td class='vtable' align='left'>\n";
  883. echo " <input type='password' style='display: none;' disabled='disabled'>\n"; //help defeat browser auto-fill
  884. echo " <input class='formfld' type='password' name='fax_email_connection_password' onmouseover=\"this.type='text';\" onfocus=\"this.type='text';\" onmouseout=\"if (!$(this).is(':focus')) { this.type='password'; }\" onblur=\"this.type='password';\" autocomplete='off' maxlength='50' value=\"".escape($fax_email_connection_password)."\">\n";
  885. echo "<br />\n";
  886. echo " ".$text['description-email_connection_password']."\n";
  887. echo "</td>\n";
  888. echo "</tr>\n";
  889. echo "<tr>\n";
  890. echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
  891. echo " ".$text['label-email_connection_mailbox']."\n";
  892. echo "</td>\n";
  893. echo "<td class='vtable' align='left'>\n";
  894. echo " <input class='formfld' type='text' name='fax_email_connection_mailbox' maxlength='255' value=\"".escape($fax_email_connection_mailbox)."\">\n";
  895. echo "<br />\n";
  896. echo " ".$text['description-email_connection_mailbox']."\n";
  897. echo "</td>\n";
  898. echo "</tr>\n";
  899. echo "</table>\n";
  900. echo " </td>";
  901. echo " <td style='white-space: nowrap;'>&nbsp;&nbsp;&nbsp;&nbsp;</td>";
  902. echo " <td width='50%' valign='top'>";
  903. echo "<table width='100%' border='0' cellpadding='0' cellspacing='0'>\n";
  904. echo "<tr>";
  905. echo "<td colspan='2'>";
  906. echo " <span style='font-weight: bold; color: #000;'>".$text['label-email_remote_inbox']."</span><br><br>";
  907. echo "</td>";
  908. echo "</tr>\n";
  909. echo "<tr>\n";
  910. echo "<td width='30%' class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
  911. echo " ".$text['label-email_inbound_subject_tag']."\n";
  912. echo "</td>\n";
  913. echo "<td width='70%' class='vtable' align='left'>\n";
  914. echo " <span style='font-size: 18px;'>[ <input class='formfld' type='text' name='fax_email_inbound_subject_tag' maxlength='255' value=\"".escape($fax_email_inbound_subject_tag)."\"> ]</span>\n";
  915. echo "<br />\n";
  916. echo " ".$text['description-email_inbound_subject_tag']."\n";
  917. echo "</td>\n";
  918. echo "</tr>\n";
  919. if (file_exists("fax_emails.php")) {
  920. echo "<tr>";
  921. echo "<td colspan='2'>";
  922. echo " <br><br>";
  923. echo " <span style='font-weight: bold; color: #000;'>".$text['label-email_email-to-fax']."</span><br><br>";
  924. echo "</td>";
  925. echo "</tr>\n";
  926. echo "<tr>\n";
  927. echo "<td width='30%' class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
  928. echo " ".$text['label-email_outbound_subject_tag']."\n";
  929. echo "</td>\n";
  930. echo "<td width='70%' class='vtable' align='left'>\n";
  931. echo " <span style='font-size: 18px;'>[ <input class='formfld' type='text' name='fax_email_outbound_subject_tag' maxlength='255' value=\"$fax_email_outbound_subject_tag\"> ]</span>\n";
  932. echo "<br />\n";
  933. echo " ".$text['description-email_outbound_subject_tag']."\n";
  934. echo "</td>\n";
  935. echo "</tr>\n";
  936. echo "<tr>\n";
  937. echo "<td class='vncell' valign='top' align='left' nowrap='nowrap'>\n";
  938. echo " ".$text['label-email_outbound_authorized_senders']."\n";
  939. echo "</td>\n";
  940. echo "<td class='vtable' align='left' valign='top'>\n";
  941. echo " <table cellpadding='0' cellspacing='0' border='0'>";
  942. echo " <tr>";
  943. echo " <td id='authorized_senders'>";
  944. if (substr_count($fax_email_outbound_authorized_senders, ',') > 0) {
  945. $senders = explode(',', $fax_email_outbound_authorized_senders);
  946. }
  947. else {
  948. $senders[] = $fax_email_outbound_authorized_senders;
  949. }
  950. $senders[] = ''; // empty one
  951. foreach ($senders as $sender_num => $sender) {
  952. echo " <input class='formfld' style='width: 225px; min-width: 225px; max-width: 225px; ".(($sender_num > 0) ? "margin-top: 3px;" : null)."' type='text' name='fax_email_outbound_authorized_senders[]' maxlength='255' value=\"$sender\">".((sizeof($senders) > 0 && $sender_num < (sizeof($senders) - 1) ) ? "<br>" : null);
  953. }
  954. echo " </td>";
  955. echo " <td style='vertical-align: bottom;'>";
  956. echo " <a href='javascript:void(0);' onclick='add_sender();'>$v_link_label_add</a>";
  957. echo " </td>";
  958. echo " </tr>";
  959. echo " </table>";
  960. echo " ".$text['description-email_outbound_authorized_senders']."\n";
  961. echo "</td>\n";
  962. echo "</tr>\n";
  963. }
  964. echo "</table>\n";
  965. echo " </td>\n";
  966. echo " </tr>\n";
  967. echo "</table>\n";
  968. echo "<br><br>\n";
  969. echo "</div>\n";
  970. }
  971. echo "</form>";
  972. //show the footer
  973. require_once "resources/footer.php";
  974. ?>