a7b90f05 |
1 | <?PHP |
2 | |
ea5f4b8e |
3 | /** |
4 | * functions for info plugin |
82d304a0 |
5 | * Copyright (c) 1999-2004 The SquirrelMail Project Team |
a7b90f05 |
6 | * Licensed under the GNU GPL. For full terms see the file COPYING. |
7 | * |
8 | * Here are two functions for the info plugin |
9 | * The first gets the CAPABILITY response from your IMAP server. |
10 | * The second runs the passed IMAP test and returns the results |
11 | * The third prints the results of the IMAP command |
12 | * to options.php. |
13 | * by: Jason Munro jason@stdbev.com |
6a85a764 |
14 | * |
15 | * $Id$ |
ea5f4b8e |
16 | * @package plugins |
17 | * @subpackage info |
a7b90f05 |
18 | */ |
19 | |
ea5f4b8e |
20 | /** |
21 | * Get the IMAP capabilities |
22 | * @return array |
23 | */ |
a7b90f05 |
24 | function get_caps($imap_stream) { |
641ad613 |
25 | return sqimap_run_command_list($imap_stream, 'CAPABILITY',false, $responses, $message,false); |
a7b90f05 |
26 | } |
27 | |
ea5f4b8e |
28 | /** |
29 | * Run an IMAP test and return the results |
30 | * @return array Response from the IMAP server |
31 | */ |
a7b90f05 |
32 | function imap_test($imap_stream, $string) { |
33 | global $default_charset; |
641ad613 |
34 | print "<TR><TD>".$string."</TD></TR>"; |
35 | $response = sqimap_run_command_list($imap_stream, trim($string),false, $responses, $message,false); |
36 | array_push($response, $responses . ' ' .$message); |
a7b90f05 |
37 | return $response; |
38 | } |
39 | |
ea5f4b8e |
40 | /** |
41 | * Print the IMAP response to options.php |
42 | */ |
a7b90f05 |
43 | function print_response($response) { |
44 | foreach($response as $index=>$value) { |
45 | if (is_array($value)) { |
46 | print_response($value); |
47 | } |
48 | else { |
49 | $value = preg_replace("/</", "<", $value); |
50 | $value = preg_replace("/>/", ">", $value); |
51 | print $value."<BR>\n"; |
52 | } |
53 | } |
54 | } |
55 | |
56 | ?> |