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.

123456789101112131415161718192021222324252627282930313233343536
  1. <?php
  2. /**
  3. +-----------------------------------------------------------------------+
  4. | program/steps/utils/html2text.inc |
  5. | |
  6. | This file is part of the Roundcube Webmail client |
  7. | Copyright (C) 2005-2015, The Roundcube Dev Team |
  8. | |
  9. | Licensed under the GNU General Public License version 3 or |
  10. | any later version with exceptions for skins & plugins. |
  11. | See the README file for a full license statement. |
  12. | |
  13. | PURPOSE: |
  14. | Convert HTML message to plain text |
  15. | |
  16. +-----------------------------------------------------------------------+
  17. | Author: Thomas Bruederli <roundcube@gmail.com> |
  18. +-----------------------------------------------------------------------+
  19. */
  20. $html = stream_get_contents(fopen('php://input', 'r'));
  21. // strip slashes if magic_quotes enabled
  22. if (get_magic_quotes_gpc() || get_magic_quotes_runtime()) {
  23. $html = stripslashes($html);
  24. }
  25. $params['links'] = (bool) rcube_utils::get_input_value('_do_links', rcube_utils::INPUT_GET);
  26. $params['width'] = (int) rcube_utils::get_input_value('_width', rcube_utils::INPUT_GET);
  27. $text = $RCMAIL->html2text($html, $params);
  28. header('Content-Type: text/plain; charset=' . RCUBE_CHARSET);
  29. print $text;
  30. exit;