Don't use 'None' in displayPageHeader() calls
[squirrelmail.git] / plugins / test / decodeheader.php
CommitLineData
3d708401 1<?php
2
3/**
4 * SquirrelMail Test Plugin
5 *
6 * This page tests the decodeHeader function.
7 *
8 * @copyright &copy; 2006 The SquirrelMail Project Team
9 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
3656ccef 10 * @version $Id$
3d708401 11 * @package plugins
12 * @subpackage test
13 */
14
15include_once('../../include/init.php');
16include_once(SM_PATH . 'functions/mime.php');
17
18global $oTemplate, $color;
19
a2ecd93e 20displayPageHeader($color, '');
3d708401 21
22
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
28);
29
30
31if (sqGetGlobalVar('lossy', $lossy, SQ_GET)) {
32 if ($lossy) {
33 $lossy_encoding = true;
34 } else {
35 if ($default_charset == 'utf-8')
36 $default_charset = 'iso-8859-1';
37 $lossy_encoding = false;
38 }
39}
40
41
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.
46
47
48echo "<strong>decodeHeader() Test:</strong>\n";
49
50
51if ($default_charset == 'utf-8' || $lossy_encoding) {
52 echo '<p><a href="decodeheader.php?lossy=0">Test with lossy_encoding OFF</a></p>';
53} else {
54 echo '<p><a href="decodeheader.php?lossy=1">Test with lossy_encoding ON</a></p>';
55}
56
57
58echo '<p>Default charset: ' . $default_charset . "<br />\n"
59 . 'Lossy_encoding: ' . ($lossy_encoding ? 'true' : 'false') . '</p>';
60
61
62echo '<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>';
63
64
65echo '<pre>';
66
67
68echo "(MDN) 000:\n html chars are not encoded,\n space is not encoded,\n 8bit chars are unmodified\n";
69foreach ($header as $test) {
70 echo htmlentities(decodeHeader($test, false, false, false));
71 echo "\n";
72}
73echo "--------\n";
74
75
76echo "(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";
77foreach ($header as $test) {
78 echo htmlentities(decodeHeader($test, false, false, true));
79 echo "\n";
80}
81echo "--------\n";
82
83
84echo "010\n";
85foreach ($header as $test) {
86 echo htmlentities(decodeHeader($test, false, true, false));
87 echo "\n";
88}
89echo "--------\n";
90
91
92echo "011\n";
93foreach ($header as $test) {
94 echo htmlentities(decodeHeader($test, false, true, true));
95 echo "\n";
96}
97echo "--------\n";
98
99
100echo "(download) 100\n";
101foreach ($header as $test) {
102 echo htmlentities(decodeHeader($test, true, false, false));
103 echo "\n";
104}
105echo "--------\n";
106
107
108echo "101\n";
109foreach ($header as $test) {
110 echo htmlentities(decodeHeader($test, true, false, true));
111 echo "\n";
112}
113echo "--------\n";
114
115
116echo "(default) 110\n";
117foreach ($header as $test) {
118 echo htmlentities(decodeHeader($test, true, true, false));
119 echo "\n";
120}
121echo "--------\n";
122
123
124echo "111\n";
125foreach ($header as $test) {
126 echo htmlentities(decodeHeader($test, true, true, true));
127 echo "\n";
128}
129echo "--------\n";
130
131
132echo '</pre>';
133
134$oTemplate->display('footer.tpl');
135
136