| 1 |
lars |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
//\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
|
|
|
4 |
//\\\ \\\\\\\\| \\
|
|
|
5 |
//\\\ @@ @@\\\\\\| Mail_IMAPv2 \\
|
|
|
6 |
//\\ @@@@ @@@@\\\\\|___________________________________________________________\\
|
|
|
7 |
//\\\@@@@| @@@@\\\\\| \\
|
|
|
8 |
//\\\ @@ |\\@@\\\\\\|(c) Copyright 2004-2005 Richard York, All rights Reserved \\
|
|
|
9 |
//\\\\ || \\\\\\\|___________________________________________________________\\
|
|
|
10 |
//\\\\ \\_ \\\\\\|Redistribution and use in source and binary forms, with or \\
|
|
|
11 |
//\\\\\ \\\\\|without modification, are permitted provided that the \\
|
|
|
12 |
//\\\\\ ---- \@@@@|following conditions are met: \\
|
|
|
13 |
//@@@@@\ \@@@@| \\
|
|
|
14 |
//@@@@@@\ \@@@@@| o Redistributions of source code must retain the above \\
|
|
|
15 |
//\\\\\\\\\\\\\\\\\\| copyright notice, this list of conditions and the \\
|
|
|
16 |
// following disclaimer. \\
|
|
|
17 |
// o Redistributions in binary form must reproduce the above copyright notice, \\
|
|
|
18 |
// this list of conditions and the following disclaimer in the documentation \\
|
|
|
19 |
// and/or other materials provided with the distribution. \\
|
|
|
20 |
// o The names of the authors may not be used to endorse or promote products \\
|
|
|
21 |
// derived from this software without specific prior written permission. \\
|
|
|
22 |
// \\
|
|
|
23 |
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" \\
|
|
|
24 |
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE \\
|
|
|
25 |
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE \\
|
|
|
26 |
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE \\
|
|
|
27 |
// BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR \\
|
|
|
28 |
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF \\
|
|
|
29 |
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS \\
|
|
|
30 |
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN \\
|
|
|
31 |
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) \\
|
|
|
32 |
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE \\
|
|
|
33 |
// POSSIBILITY OF SUCH DAMAGE. \\
|
|
|
34 |
//\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
|
|
|
35 |
|
|
|
36 |
/**
|
|
|
37 |
* This class provides an extension to Mail_IMAPv2 that adds debugging
|
|
|
38 |
* utilities for the base IMAP.php class. The debugging functionality
|
|
|
39 |
* provided by this class is currently accessed by supplying various
|
|
|
40 |
* $_GET method arguments.
|
|
|
41 |
*
|
|
|
42 |
* @author Richard York <rich_y@php.net>
|
|
|
43 |
* @category Mail
|
|
|
44 |
* @package Mail_IMAPv2
|
|
|
45 |
* @license BSD
|
|
|
46 |
* @version 0.1.0 Beta
|
|
|
47 |
* @copyright (c) Copyright 2004-2005, Richard York, All Rights Reserved.
|
|
|
48 |
* @since PHP 4.2.0
|
|
|
49 |
* @since C-Client 2001
|
|
|
50 |
* @tutorial http://www.smilingsouls.net/Mail_IMAP
|
|
|
51 |
*/
|
|
|
52 |
class Mail_IMAPv2_Debug extends Mail_IMAPv2 {
|
|
|
53 |
|
|
|
54 |
function Mail_IMAPv2_Debug($connection = NULL, $get_info = TRUE)
|
|
|
55 |
{
|
|
|
56 |
$this->Mail_IMAPv2($connection, $get_info);
|
|
|
57 |
|
|
|
58 |
if (isset($_GET['dump_mid'])) {
|
|
|
59 |
$this->debug($_GET['dump_mid']);
|
|
|
60 |
} else {
|
|
|
61 |
$this->error->push(Mail_IMAPv2_ERROR, 'error', array('method' => 'Mail_IMAPv2_Debug', 'error_string' => 'No mid was specified for debugging.'));
|
|
|
62 |
}
|
|
|
63 |
}
|
|
|
64 |
|
|
|
65 |
/**
|
|
|
66 |
* Dumps various information about a message for debugging. Specify $_GET
|
|
|
67 |
* variables to view information.
|
|
|
68 |
*
|
|
|
69 |
* Calling on the debugger exits script execution after debugging operations
|
|
|
70 |
* have been completed.
|
|
|
71 |
*
|
|
|
72 |
* @param int $mid $mid to debug
|
|
|
73 |
* @return void
|
|
|
74 |
* @access public
|
|
|
75 |
* @tutorial http://www.smilingsouls.net/Mail_IMAP?content=Mail_IMAP_Debug/debug
|
|
|
76 |
*/
|
|
|
77 |
function debug($mid = 0)
|
|
|
78 |
{
|
|
|
79 |
$this->_declareParts($mid);
|
|
|
80 |
|
|
|
81 |
if (isset($_GET['dump_mb_info'])) {
|
|
|
82 |
$this->dump($this->mailboxInfo);
|
|
|
83 |
}
|
|
|
84 |
if (isset($_GET['dump_cid'])) {
|
|
|
85 |
$this->dump($this->msg[$mid]['in']['cid']);
|
|
|
86 |
}
|
|
|
87 |
if (isset($_GET['dump_related'])) {
|
|
|
88 |
$this->dump($this->getRelatedParts($mid, $_GET['dump_related']));
|
|
|
89 |
}
|
|
|
90 |
if (isset($_GET['dump_msg']) && isset($_GET['dump_pid'])) {
|
|
|
91 |
$this->getParts($mid, $_GET['dump_pid']);
|
|
|
92 |
$this->dump($this->msg);
|
|
|
93 |
}
|
|
|
94 |
if (isset($_GET['dump_pid'])) {
|
|
|
95 |
$this->dump($this->structure[$mid]['pid']);
|
|
|
96 |
}
|
|
|
97 |
if (isset($_GET['dump_ftype'])) {
|
|
|
98 |
$this->dump($this->structure[$mid]['ftype']);
|
|
|
99 |
}
|
|
|
100 |
if (isset($_GET['dump_structure'])) {
|
|
|
101 |
$this->dump($this->structure[$mid]['obj']);
|
|
|
102 |
}
|
|
|
103 |
if (isset($_GET['test_pid'])) {
|
|
|
104 |
echo imap_fetchbody($this->mailbox, $mid, $_GET['test_pid'], NULL);
|
|
|
105 |
}
|
|
|
106 |
if (isset($_GET['dump_mb_list'])) {
|
|
|
107 |
$this->dump($this->getMailboxes());
|
|
|
108 |
}
|
|
|
109 |
if (isset($_GET['dump_headers'])) {
|
|
|
110 |
$this->dump($this->getHeaders($mid, $_GET['dump_headers'], TRUE));
|
|
|
111 |
}
|
|
|
112 |
if ($this->error->hasErrors()) {
|
|
|
113 |
$this->dump($this->error->getErrors(TRUE));
|
|
|
114 |
}
|
|
|
115 |
}
|
|
|
116 |
|
|
|
117 |
/**
|
|
|
118 |
* Calls on var_dump and outputs with HTML <pre> tags.
|
|
|
119 |
*
|
|
|
120 |
* @param mixed $thing $thing to dump.
|
|
|
121 |
* @return void
|
|
|
122 |
* @access public
|
|
|
123 |
* @tutorial http://www.smilingsouls.net/Mail_IMAP?content=Mail_IMAP_Debug/dump
|
|
|
124 |
*/
|
|
|
125 |
function dump(&$thing)
|
|
|
126 |
{
|
|
|
127 |
echo "<pre style='display: block; font-family: monospace; white-space: pre;'>\n";
|
|
|
128 |
|
|
|
129 |
ob_end_flush();
|
|
|
130 |
ob_start();
|
|
|
131 |
var_dump($thing);
|
|
|
132 |
$output = ob_get_contents();
|
|
|
133 |
ob_end_clean();
|
|
|
134 |
echo htmlspecialchars($output);
|
|
|
135 |
echo "</pre>\n";
|
|
|
136 |
}
|
|
|
137 |
}
|
|
|
138 |
|
|
|
139 |
?>
|