Keep on going... rg=0
[squirrelmail.git] / plugins / info / functions.php
... / ...
CommitLineData
1<?PHP
2
3/* functions for info plugin
4 * Copyright (c) 1999-2002 The SquirrelMail Project Team
5 * Licensed under the GNU GPL. For full terms see the file COPYING.
6 *
7 * Here are two functions for the info plugin
8 * The first gets the CAPABILITY response from your IMAP server.
9 * The second runs the passed IMAP test and returns the results
10 * The third prints the results of the IMAP command
11 * to options.php.
12 * by: Jason Munro jason@stdbev.com
13 */
14
15function get_caps($imap_stream) {
16 $sid = sqimap_session_id();
17 $query = "$sid CAPABILITY\r\n";
18 fputs ($imap_stream, $query);
19 $responses = sqimap_read_data_list($imap_stream, $sid, true, $responses, $message);
20 return $responses;
21}
22
23function imap_test($imap_stream, $string) {
24 global $default_charset;
25 $message = '';
26 $responses = array ();
27 $sid = sqimap_session_id();
28 $results = array();
29 $query = "$sid ".trim($string)."\r\n";
30 print "<TR><TD>".$query."</TD></TR>";
31 fputs ($imap_stream, $query);
32 $response = sqimap_read_data_list($imap_stream, $sid, false, $responses, $message);
33 array_push($response, $message);
34 return $response;
35}
36
37function print_response($response) {
38 foreach($response as $index=>$value) {
39 if (is_array($value)) {
40 print_response($value);
41 }
42 else {
43 $value = preg_replace("/</", "&lt;", $value);
44 $value = preg_replace("/>/", "&gt;", $value);
45 print $value."<BR>\n";
46 }
47 }
48}
49
50?>