| 1 | <?php |
| 2 | /** |
| 3 | * functions for info plugin |
| 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. |
| 10 | * |
| 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$ |
| 15 | * @package plugins |
| 16 | * @subpackage info |
| 17 | */ |
| 18 | |
| 19 | /** |
| 20 | * Get the IMAP capabilities |
| 21 | * |
| 22 | * @param mixed $imap_stream |
| 23 | * @return array |
| 24 | * @access private |
| 25 | */ |
| 26 | function get_caps($imap_stream) { |
| 27 | return sqimap_run_command_list($imap_stream, 'CAPABILITY',false, $responses, $message,false); |
| 28 | } |
| 29 | |
| 30 | /** |
| 31 | * Run an IMAP test and return the results |
| 32 | * |
| 33 | * @param mixed $imap_stream |
| 34 | * @param string $string imap command |
| 35 | * @return array Response from the IMAP server |
| 36 | * @access private |
| 37 | */ |
| 38 | function imap_test($imap_stream, $string) { |
| 39 | print "<tr><td>".htmlspecialchars($string)."</td></tr>"; |
| 40 | $response = sqimap_run_command_list($imap_stream, trim($string),false, $responses, $message,false); |
| 41 | array_push($response, $responses . ' ' .$message); |
| 42 | return $response; |
| 43 | } |
| 44 | |
| 45 | /** |
| 46 | * Print the IMAP response to options.php |
| 47 | * |
| 48 | * @param array $response results of imap command |
| 49 | * @access private |
| 50 | */ |
| 51 | function print_response($response) { |
| 52 | foreach($response as $index=>$value) { |
| 53 | if (is_array($value)) { |
| 54 | print_response($value); |
| 55 | } |
| 56 | else { |
| 57 | print htmlspecialchars($value)."<br />\n"; |
| 58 | } |
| 59 | } |
| 60 | } |
| 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 | ?> |