voicemail_msgs_delete.php 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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 <[email protected]>
  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 <[email protected]>
  20. */
  21. include "root.php";
  22. require "resources/require.php";
  23. require_once "resources/check_auth.php";
  24. require_once "app_languages.php";
  25. if (permission_exists('voicemail_delete')) {
  26. //access granted
  27. }
  28. else {
  29. echo "access denied";
  30. exit;
  31. }
  32. //add multi-lingual support
  33. $language = new text;
  34. $text = $language->get();
  35. //get the http get values
  36. if (count($_GET) > 0) {
  37. $uuid = $_GET["uuid"];
  38. $id = $_GET["id"];
  39. }
  40. //get the domain from the domains array
  41. $domain_name = $_SESSION['domains'][$domain_uuid]['domain_name'];
  42. //create the event socket connection
  43. $fp = event_socket_create($_SESSION['event_socket_ip_address'], $_SESSION['event_socket_port'], $_SESSION['event_socket_password']);
  44. if (!$fp) {
  45. $msg = "<div align='center'>".$text['confirm-socket']."<br /></div>";
  46. }
  47. //show the error message or show the content
  48. if (strlen($msg) > 0) {
  49. require_once "resources/header.php";
  50. echo "<div align='center'>\n";
  51. echo " <table width='40%'>\n";
  52. echo " <tr>\n";
  53. echo " <th align='left'>".$text['label-message']."</th>\n";
  54. echo " </tr>\n";
  55. echo " <tr>\n";
  56. echo " <td class='row_style1'><strong>$msg</strong></td>\n";
  57. echo " </tr>\n";
  58. echo " </table>\n";
  59. echo "</div>\n";
  60. require_once "resources/footer.php";
  61. return;
  62. }
  63. // delete the voicemail
  64. $cmd = "api vm_delete " .$id."@".$domain_name." ".$uuid;
  65. $response = trim(event_socket_request($fp, $cmd));
  66. echo $xml_response;
  67. if (strcmp($response,"+OK")==0) {
  68. $msg = "".$text['confirm-complete']."";
  69. }
  70. else {
  71. $msg = "".$text['confirm-failed']."";
  72. }
  73. //redirect the user
  74. require_once "resources/header.php";
  75. echo "<meta http-equiv=\"refresh\" content=\"2;url=voicemail_msgs.php\">\n";
  76. echo "<div align='center'>\n";
  77. echo "".$text['confirm-delete-2']." $msg\n";
  78. echo "</div>\n";
  79. require_once "resources/footer.php";
  80. return;
  81. ?>