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.

139 lines
4.2 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-2012
  17. the Initial Developer. All Rights Reserved.
  18. Contributor(s):
  19. Mark J Crane <markjcrane@fusionpbx.com>
  20. */
  21. include "root.php";
  22. require_once "resources/require.php";
  23. require_once "resources/check_auth.php";
  24. if (permission_exists('fax_active_view')) {
  25. //access granted
  26. }
  27. else {
  28. echo "access denied";
  29. exit;
  30. }
  31. //add multi-lingual support
  32. $language = new text;
  33. $text = $language->get();
  34. //get the HTTP values and set as variables
  35. $show = $_REQUEST["show"];
  36. $fax_uuid = $_REQUEST["id"];
  37. //load gateways into a session variable
  38. $sql = "select gateway_uuid, domain_uuid, gateway from v_gateways where enabled = 'true'";
  39. $database = new database;
  40. $result = $database->select($sql, null, 'all');
  41. if (is_array($result) && @sizeof($result) != 0) {
  42. foreach ($result as $row) {
  43. $_SESSION['gateways'][$row['gateway_uuid']] = $row['gateway'];
  44. }
  45. }
  46. unset($sql, $result, $row);
  47. //show the header
  48. $document['title'] = $text['title'];
  49. require_once "resources/header.php";
  50. //ajax for refresh
  51. ?>
  52. <script type="text/javascript">
  53. //define refresh function, initial start
  54. var refresh = 1500;
  55. var source_url = 'fax_active_inc.php?';
  56. var timer_id;
  57. <?php
  58. if ($show == 'all') {
  59. echo "source_url = source_url + '&show=all';";
  60. }
  61. if (is_uuid($fax_uuid)) {
  62. echo "source_url = source_url + '&id=".$fax_uuid."';";
  63. }
  64. if (isset($_REQUEST["debug"])) {
  65. echo "source_url = source_url + '&debug';";
  66. }
  67. ?>
  68. var ajax_get = function () {
  69. $.ajax({
  70. url: source_url, success: function(response){
  71. $("#ajax_reponse").html(response);
  72. }
  73. });
  74. timer_id = setTimeout(ajax_get, refresh);
  75. };
  76. refresh_start();
  77. //refresh controls
  78. function refresh_stop() {
  79. clearTimeout(timer_id);
  80. document.getElementById('refresh_state').innerHTML = "<img src='resources/images/refresh_paused.png' style='width: 16px; height: 16px; border: none; margin-top: 1px; cursor: pointer;' onclick='refresh_start();' alt=\"<?php echo $text['label-refresh_enable']?>\" title=\"<?php echo $text['label-refresh_enable']?>\">";
  81. }
  82. function refresh_start() {
  83. if (document.getElementById('refresh_state')) { document.getElementById('refresh_state').innerHTML = "<img src='resources/images/refresh_active.gif' style='width: 16px; height: 16px; border: none; margin-top: 3px; cursor: pointer;' alt=\"<?php echo $text['label-refresh_pause']?>\" title=\"<?php echo $text['label-refresh_pause']?>\">"; }
  84. ajax_get();
  85. }
  86. //call controls
  87. function hangup(uuid) {
  88. if (confirm("<?php echo $text['confirm-hangup']?>")) {
  89. send_cmd('fax_active_exec.php?cmd=delete&id='+uuid);
  90. }
  91. }
  92. function send_cmd(url) {
  93. if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
  94. xmlhttp=new XMLHttpRequest();
  95. }
  96. else {// code for IE6, IE5
  97. xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  98. }
  99. xmlhttp.open("GET",url,false);
  100. xmlhttp.send(null);
  101. document.getElementById('cmd_reponse').innerHTML=xmlhttp.responseText;
  102. }
  103. </script>
  104. <?php
  105. echo "<div id='ajax_reponse'></div>\n";
  106. echo "<div id='time_stamp' style='visibility:hidden'>".date('Y-m-d-s')."</div>\n";
  107. echo "<br><br><br>";
  108. require_once "resources/footer.php";
  109. /*
  110. // deprecated functions for this page
  111. function get_park_cmd(uuid, context) {
  112. cmd = \"uuid_transfer \"+uuid+\" -bleg *6000 xml \"+context;
  113. return escape(cmd);
  114. }
  115. function get_record_cmd(uuid, prefix, name) {
  116. cmd = \"uuid_record \"+uuid+\" start ".$_SESSION['switch']['recordings']['dir']."/".$_SESSION['domain_name']."/archive/".date("Y")."/".date("M")."/".date("d")."/\"+uuid+\".wav\";
  117. return escape(cmd);
  118. }
  119. */
  120. ?>