Source for file functions.php

Documentation is available at functions.php

  1. <?php
  2.  
  3. /* functions for info plugin
  4.  * Copyright (c) 1999-2020 The SquirrelMail Project Team
  5.  * Licensed under the GNU GPL. For full terms see the file COPYING.
  6.  *
  7.  * Here are two functions for the info plugin
  8.  * The first gets the CAPABILITY response from your IMAP server.
  9.  * The second runs the passed IMAP test and returns the results 
  10.  * The third prints the results of the IMAP command
  11.  * to options.php.
  12.  * by: Jason Munro [email protected]
  13.  *
  14.  * $Id: functions.php 14840 2020-01-07 07:42:38Z pdontthink $ 
  15.  *
  16.  */
  17.  
  18. function get_caps($imap_stream) {
  19.     $sid = sqimap_session_id();
  20.     $query = "$sid CAPABILITY\r\n";
  21.     fputs ($imap_stream, $query);
  22.     $responses = sqimap_read_data_list($imap_stream, $sid, true, $responses, $message);
  23.     return $responses;
  24. }
  25.  
  26. function imap_test($imap_stream, $string) {
  27.     global $default_charset;
  28.     $message = '';
  29.     $responses = array ();
  30.     $sid = sqimap_session_id();
  31.     $results = array();
  32.     $query = "$sid ".trim($string)."\r\n";
  33.     print "<tr><td>".sm_encode_html_special_chars($query)."</td></tr>";
  34.     fputs ($imap_stream, $query);
  35.     $response = sqimap_read_data_list($imap_stream, $sid, false, $responses, $message);
  36.     array_push($response, $message);
  37.     return $response;
  38. }
  39.  
  40. function print_response($response) {
  41.     foreach($response as $index=>$value) {
  42.         if (is_array($value)) {
  43.             print_response($value);
  44.         }
  45.         else {
  46.             print sm_encode_html_special_chars($value)."<br>\n";
  47.         }
  48.     }
  49. }
  50.  
  51. /**
  52.  * Check if plugin is enabled
  53.  * @param string $plugin_name plugin name
  54.  * @return boolean 
  55.  */
  56. function info_is_plugin_enabled($plugin_name) {
  57.     global $plugins;
  58.  
  59.     if (empty($plugins) || ! is_array($plugins))
  60.         return false;
  61.     
  62.     if ( in_array($plugin_name,$plugins) ) {
  63.         return true;
  64.     } else {
  65.         return false;
  66.     }
  67. }

Documentation generated on Mon, 13 Jan 2020 04:24:39 +0100 by phpDocumentor 1.4.3