Happy New Year
[squirrelmail.git] / plugins / info / functions.php
CommitLineData
b11fe046 1<?php
4b4abf93 2
ea5f4b8e 3/**
4 * functions for info plugin
a7b90f05 5 *
6 * Here are two functions for the info plugin
7 * The first gets the CAPABILITY response from your IMAP server.
91e0dccc 8 * The second runs the passed IMAP test and returns the results
a7b90f05 9 * The third prints the results of the IMAP command
10 * to options.php.
6a85a764 11 *
4b4abf93 12 * @author Jason Munro <jason at stdbev.com>
c4faef33 13 * @copyright 1999-2020 The SquirrelMail Project Team
b11fe046 14 * @license http://opensource.org/licenses/gpl-license.php GNU Public License
b11fe046 15 * @version $Id$
ea5f4b8e 16 * @package plugins
17 * @subpackage info
a7b90f05 18 */
19
ea5f4b8e 20/**
21 * Get the IMAP capabilities
b11fe046 22 *
23 * @param mixed $imap_stream
ea5f4b8e 24 * @return array
b11fe046 25 * @access private
ea5f4b8e 26 */
a7b90f05 27function get_caps($imap_stream) {
641ad613 28 return sqimap_run_command_list($imap_stream, 'CAPABILITY',false, $responses, $message,false);
a7b90f05 29}
30
ea5f4b8e 31/**
32 * Run an IMAP test and return the results
b11fe046 33 *
34 * @param mixed $imap_stream
35 * @param string $string imap command
ea5f4b8e 36 * @return array Response from the IMAP server
b11fe046 37 * @access private
ea5f4b8e 38 */
a7b90f05 39function imap_test($imap_stream, $string) {
3047e291 40 print "<tr><td>".sm_encode_html_special_chars($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) {
fb0bcfdb 53 foreach($response as $value) {
a7b90f05 54 if (is_array($value)) {
55 print_response($value);
56 }
57 else {
3047e291 58 print sm_encode_html_special_chars($value)."<br />\n";
a7b90f05 59 }
60 }
61}