functions.php 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. * @author Jason Munro <jason at stdbev.com>
  12. * @copyright &copy; 1999-2007 The SquirrelMail Project Team
  13. * @license http://opensource.org/licenses/gpl-license.php GNU Public License
  14. * @version $Id$
  15. * @package plugins
  16. * @subpackage info
  17. */
  18. /**
  19. * Get the IMAP capabilities
  20. *
  21. * @param mixed $imap_stream
  22. * @return array
  23. * @access private
  24. */
  25. function get_caps($imap_stream) {
  26. return sqimap_run_command_list($imap_stream, 'CAPABILITY',false, $responses, $message,false);
  27. }
  28. /**
  29. * Run an IMAP test and return the results
  30. *
  31. * @param mixed $imap_stream
  32. * @param string $string imap command
  33. * @return array Response from the IMAP server
  34. * @access private
  35. */
  36. function imap_test($imap_stream, $string) {
  37. print "<tr><td>".htmlspecialchars($string)."</td></tr>";
  38. $response = sqimap_run_command_list($imap_stream, trim($string),false, $responses, $message,false);
  39. array_push($response, $responses . ' ' .$message);
  40. return $response;
  41. }
  42. /**
  43. * Print the IMAP response to options.php
  44. *
  45. * @param array $response results of imap command
  46. * @access private
  47. */
  48. function print_response($response) {
  49. foreach($response as $value) {
  50. if (is_array($value)) {
  51. print_response($value);
  52. }
  53. else {
  54. print htmlspecialchars($value)."<br />\n";
  55. }
  56. }
  57. }