4 * SquirrelMail Test Plugin
6 * This page tests the decodeHeader function.
8 * @copyright 2006-2017 The SquirrelMail Project Team
9 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
15 include_once('../../include/init.php');
16 include_once(SM_PATH
. 'functions/mime.php');
18 global $oTemplate, $color;
20 displayPageHeader($color, '');
23 $header = array("< & \xC3", // plain text
24 '=?iso-8859-1?Q?=3C_&__=C3?=', // Q encoding
25 '=?iso-8859-1?B?PCAmICDD?=', // B encoding
26 '=?utf-8?Q?=3C_&__=C3=80?=', // Q encoding other charset
27 '=?utf-8?B?PCAmICDDgA==?=', // B encoding other charset
31 if (sqGetGlobalVar('lossy', $lossy, SQ_GET
)) {
33 $lossy_encoding = true;
35 if ($default_charset == 'utf-8')
36 $default_charset = 'iso-8859-1';
37 $lossy_encoding = false;
42 // NOTE: Not bothering to "templatize" the following output, since
43 // this plugin is merely an administrative (and not user-facing)
44 // tool. If this is really important to you, please help by
45 // submitting the work to the team.
48 echo "<strong>decodeHeader() Test:</strong>\n";
51 if ($default_charset == 'utf-8' ||
$lossy_encoding) {
52 echo '<p><a href="decodeheader.php?lossy=0">Test with lossy_encoding OFF</a></p>';
54 echo '<p><a href="decodeheader.php?lossy=1">Test with lossy_encoding ON</a></p>';
58 echo '<p>Default charset: ' . $default_charset . "<br />\n"
59 . 'Lossy_encoding: ' . ($lossy_encoding ?
'true' : 'false') . '</p>';
62 echo '<p>The results of this test depend on your current language (translation) selection (see Options==>Display Preferences) (and the character set it employs) and your $lossy_encoding setting (see config/config.php or conf.pl ==> 10 ==> 5).</p>';
68 echo "(MDN) 000:\n html chars are not encoded,\n space is not encoded,\n 8bit chars are unmodified\n";
69 foreach ($header as $test) {
70 echo htmlentities(decodeHeader($test, false, false, false));
76 echo "(compose) 001:\n html chars are not encoded,\n space is not encoded,\n 8bit chars may be converted or not (depends on \$lossy_encoding and \$default_charset)\n";
77 foreach ($header as $test) {
78 echo htmlentities(decodeHeader($test, false, false, true));
85 foreach ($header as $test) {
86 echo htmlentities(decodeHeader($test, false, true, false));
93 foreach ($header as $test) {
94 echo htmlentities(decodeHeader($test, false, true, true));
100 echo "(download) 100\n";
101 foreach ($header as $test) {
102 echo htmlentities(decodeHeader($test, true, false, false));
109 foreach ($header as $test) {
110 echo htmlentities(decodeHeader($test, true, false, true));
116 echo "(default) 110\n";
117 foreach ($header as $test) {
118 echo htmlentities(decodeHeader($test, true, true, false));
125 foreach ($header as $test) {
126 echo htmlentities(decodeHeader($test, true, true, true));
134 $oTemplate->display('footer.tpl');