Aleksander Machniak
2016-04-15 ead084693499934c467ca6a9c396367ac661dd61
commit | author | age
dd53e2 1 <?php
677e1f 2
041c93 3 /*
dd53e2 4  +-----------------------------------------------------------------------+
677e1f 5  | program/steps/utils/html2text.inc                                     |
dd53e2 6  |                                                                       |
e019f2 7  | This file is part of the Roundcube Webmail client                     |
eddae8 8  | Copyright (C) 2005-2015, The Roundcube Dev Team                       |
7fe381 9  |                                                                       |
T 10  | Licensed under the GNU General Public License version 3 or            |
11  | any later version with exceptions for skins & plugins.                |
12  | See the README file for a full license statement.                     |
dd53e2 13  |                                                                       |
T 14  | PURPOSE:                                                              |
677e1f 15  |   Convert HTML message to plain text                                  |
dd53e2 16  |                                                                       |
T 17  +-----------------------------------------------------------------------+
677e1f 18  | Author: Thomas Bruederli <roundcube@gmail.com>                        |
dd53e2 19  +-----------------------------------------------------------------------+
T 20 */
21
60a67f 22 $html = stream_get_contents(fopen('php://input', 'r'));
747289 23
efc470 24 // strip slashes if magic_quotes enabled
AM 25 if (get_magic_quotes_gpc() || get_magic_quotes_runtime()) {
26     $html = stripslashes($html);
27 }
28
747289 29 // Replace emoticon images with its text representation
6b2b2e 30 $html = $RCMAIL->replace_emoticons($html);
747289 31
ead084 32 $params['links'] = (bool) rcube_utils::get_input_value('_do_links', rcube_utils::INPUT_GET);
AM 33 $params['width'] = (int) rcube_utils::get_input_value('_width', rcube_utils::INPUT_GET);
eddae8 34
ead084 35 $text = $RCMAIL->html2text($html, $params);
dd53e2 36
ead084 37 header('Content-Type: text/plain; charset=' . RCUBE_CHARSET);
AM 38 print $text;
dd53e2 39 exit;