XHTML fixes
[squirrelmail.git] / plugins / info / functions.php
CommitLineData
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 26function 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 38function imap_test($imap_stream, $string) {
39 global $default_charset;
a9e1e670 40 print "<tr><td>".htmlspecialchars($string)."</td></tr>";
641ad613 41 $response = sqimap_run_command_list($imap_stream, trim($string),false, $responses, $message,false);
42 array_push($response, $responses . ' ' .$message);
a7b90f05 43 return $response;
44}
45
ea5f4b8e 46/**
47 * Print the IMAP response to options.php
b11fe046 48 *
49 * @param array $response results of imap command
50 * @access private
ea5f4b8e 51 */
a7b90f05 52function print_response($response) {
53 foreach($response as $index=>$value) {
54 if (is_array($value)) {
55 print_response($value);
56 }
57 else {
a9e1e670 58 print htmlspecialchars($value)."<br />\n";
a7b90f05 59 }
60 }
61}
b11fe046 62
63/**
64 * Check if plugin is enabled
65 * @param string $plugin_name plugin name
66 * @return boolean
67 */
68function is_plugin_enabled($plugin_name) {
69 global $plugins;
70 if ( in_array($plugin_name,$plugins) ) {
71 return true;
72 } else {
73 return false;
74 }
75}
76?>