HTML escaping.
[squirrelmail.git] / plugins / info / functions.php
1 <?PHP
2
3 /**
4 * functions for info plugin
5 * Copyright (c) 1999-2004 The SquirrelMail Project Team
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
14 *
15 * $Id$
16 * @package plugins
17 * @subpackage info
18 */
19
20 /**
21 * Get the IMAP capabilities
22 * @return array
23 */
24 function get_caps($imap_stream) {
25 return sqimap_run_command_list($imap_stream, 'CAPABILITY',false, $responses, $message,false);
26 }
27
28 /**
29 * Run an IMAP test and return the results
30 * @return array Response from the IMAP server
31 */
32 function imap_test($imap_stream, $string) {
33 global $default_charset;
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);
37 return $response;
38 }
39
40 /**
41 * Print the IMAP response to options.php
42 */
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("/</", "&lt;", $value);
50 $value = preg_replace("/>/", "&gt;", $value);
51 print $value."<BR>\n";
52 }
53 }
54 }
55
56 ?>