functions.php 1.9 KB

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