message_send.php 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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) 2024
  17. the Initial Developer. All Rights Reserved.
  18. Contributor(s):
  19. Mark J Crane <[email protected]>
  20. */
  21. //includes files
  22. require_once dirname(__DIR__, 2) . "/resources/require.php";
  23. require_once "resources/check_auth.php";
  24. //check permissions
  25. if (!permission_exists('message_add') && !permission_exists('message_edit')) {
  26. echo "access denied";
  27. exit;
  28. }
  29. //add multi-lingual support
  30. $language = new text;
  31. $text = $language->get();
  32. //get http post variables and set them to php variables
  33. if (!empty($_REQUEST) && is_array($_REQUEST)) {
  34. //$message_from = $_REQUEST["message_from"];
  35. //$message_to = $_REQUEST["message_to"];
  36. $message_from = urldecode($_REQUEST["message_from"]);
  37. $message_to = urldecode($_REQUEST["message_to"]);
  38. $message_text = $_REQUEST["message_text"];
  39. $message_media = $_FILES["message_media"];
  40. }
  41. //translate the %2b to a '+' and its already a plus preserve the + rather than converting it into a space
  42. //if (isset($message_from)) {
  43. // $message_from = str_replace('%2b', '+', $message_from);
  44. //}
  45. //if (isset($message_to)) {
  46. // $message_to = str_replace('%2b', '+', $message_to);
  47. //}
  48. //send the message
  49. if (!empty($_REQUEST) && count($_REQUEST) > 0 && (empty($_REQUEST["persistformvar"]) || strlen($_REQUEST["persistformvar"]) == 0)) {
  50. $message = new messages;
  51. $message->send('sms', $message_from, $message_to, $message_text, $message_media);
  52. }
  53. //URL to send
  54. // https://voip.fusionpbx.com/app/messages/message_send.php?message_from=12083334444&message_to=12083330000&message_text=bbb
  55. ?>