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