b11fe046 |
1 | <?php |
ea5f4b8e |
2 | /** |
3 | * functions for info plugin |
a7b90f05 |
4 | * |
5 | * Here are two functions for the info plugin |
6 | * The first gets the CAPABILITY response from your IMAP server. |
7 | * The second runs the passed IMAP test and returns the results |
8 | * The third prints the results of the IMAP command |
9 | * to options.php. |
6a85a764 |
10 | * |
b11fe046 |
11 | * @copyright (c) 1999-2004 The SquirrelMail Project Team |
12 | * @license http://opensource.org/licenses/gpl-license.php GNU Public License |
13 | * @author Jason Munro jason@stdbev.com |
14 | * @version $Id$ |
ea5f4b8e |
15 | * @package plugins |
16 | * @subpackage info |
a7b90f05 |
17 | */ |
18 | |
ea5f4b8e |
19 | /** |
20 | * Get the IMAP capabilities |
b11fe046 |
21 | * |
22 | * @param mixed $imap_stream |
ea5f4b8e |
23 | * @return array |
b11fe046 |
24 | * @access private |
ea5f4b8e |
25 | */ |
a7b90f05 |
26 | function get_caps($imap_stream) { |
641ad613 |
27 | return sqimap_run_command_list($imap_stream, 'CAPABILITY',false, $responses, $message,false); |
a7b90f05 |
28 | } |
29 | |
ea5f4b8e |
30 | /** |
31 | * Run an IMAP test and return the results |
b11fe046 |
32 | * |
33 | * @param mixed $imap_stream |
34 | * @param string $string imap command |
ea5f4b8e |
35 | * @return array Response from the IMAP server |
b11fe046 |
36 | * @access private |
ea5f4b8e |
37 | */ |
a7b90f05 |
38 | function imap_test($imap_stream, $string) { |
a9e1e670 |
39 | print "<tr><td>".htmlspecialchars($string)."</td></tr>"; |
641ad613 |
40 | $response = sqimap_run_command_list($imap_stream, trim($string),false, $responses, $message,false); |
41 | array_push($response, $responses . ' ' .$message); |
a7b90f05 |
42 | return $response; |
43 | } |
44 | |
ea5f4b8e |
45 | /** |
46 | * Print the IMAP response to options.php |
b11fe046 |
47 | * |
48 | * @param array $response results of imap command |
49 | * @access private |
ea5f4b8e |
50 | */ |
a7b90f05 |
51 | function print_response($response) { |
52 | foreach($response as $index=>$value) { |
53 | if (is_array($value)) { |
54 | print_response($value); |
55 | } |
56 | else { |
a9e1e670 |
57 | print htmlspecialchars($value)."<br />\n"; |
a7b90f05 |
58 | } |
59 | } |
60 | } |
b11fe046 |
61 | |
62 | /** |
63 | * Check if plugin is enabled |
64 | * @param string $plugin_name plugin name |
65 | * @return boolean |
66 | */ |
67 | function is_plugin_enabled($plugin_name) { |
68 | global $plugins; |
69 | if ( in_array($plugin_name,$plugins) ) { |
70 | return true; |
71 | } else { |
72 | return false; |
73 | } |
74 | } |
75 | ?> |