Small fix to tassium code, if you chomp something it can never match
[squirrelmail.git] / plugins / info / functions.php
CommitLineData
a7b90f05 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
6a85a764 13 *
14 * $Id$
15 *
a7b90f05 16 */
17
18function get_caps($imap_stream) {
19 $sid = sqimap_session_id();
20 $query = "$sid CAPABILITY\r\n";
21 fputs ($imap_stream, $query);
22 $responses = sqimap_read_data_list($imap_stream, $sid, true, $responses, $message);
23 return $responses;
24}
25
26function imap_test($imap_stream, $string) {
27 global $default_charset;
28 $message = '';
29 $responses = array ();
30 $sid = sqimap_session_id();
31 $results = array();
32 $query = "$sid ".trim($string)."\r\n";
33 print "<TR><TD>".$query."</TD></TR>";
34 fputs ($imap_stream, $query);
35 $response = sqimap_read_data_list($imap_stream, $sid, false, $responses, $message);
36 array_push($response, $message);
37 return $response;
38}
39
40function print_response($response) {
41 foreach($response as $index=>$value) {
42 if (is_array($value)) {
43 print_response($value);
44 }
45 else {
46 $value = preg_replace("/</", "&lt;", $value);
47 $value = preg_replace("/>/", "&gt;", $value);
48 print $value."<BR>\n";
49 }
50 }
51}
52
53?>