The copyright message should be consistent.
[squirrelmail.git] / plugins / info / functions.php
index b715d933ce327dcc267ac8bfe4898ecc3a2d8fc5..a62294a01efe792eba35d8bdd8a5a2eb885a68e8 100644 (file)
@@ -1,25 +1,27 @@
-<?PHP
-
+<?php
 /**
  * functions for info plugin
- * Copyright (c) 1999-2004 The SquirrelMail Project Team
- * Licensed under the GNU GPL. For full terms see the file COPYING.
  *
  * Here are two functions for the info plugin
  * The first gets the CAPABILITY response from your IMAP server.
- * The second runs the passed IMAP test and returns the results 
+ * The second runs the passed IMAP test and returns the results
  * The third prints the results of the IMAP command
  * to options.php.
- * by: Jason Munro jason@stdbev.com
  *
- * $Id$ 
+ * @copyright (c) 1999-2005 The SquirrelMail Project Team
+ * @license http://opensource.org/licenses/gpl-license.php GNU Public License
+ * @author Jason Munro jason@stdbev.com
+ * @version $Id$
  * @package plugins
  * @subpackage info
  */
 
 /**
  * Get the IMAP capabilities
+ *
+ * @param mixed $imap_stream
  * @return array
+ * @access private
  */
 function get_caps($imap_stream) {
     return sqimap_run_command_list($imap_stream, 'CAPABILITY',false, $responses, $message,false);
@@ -27,11 +29,14 @@ function get_caps($imap_stream) {
 
 /**
  * Run an IMAP test and return the results
+ *
+ * @param mixed $imap_stream
+ * @param string $string imap command
  * @return array Response from the IMAP server
+ * @access private
  */
 function imap_test($imap_stream, $string) {
-    global $default_charset;
-    print "<TR><TD>".$string."</TD></TR>";
+    print "<tr><td>".htmlspecialchars($string)."</td></tr>";
     $response = sqimap_run_command_list($imap_stream, trim($string),false, $responses, $message,false);
     array_push($response, $responses . ' ' .$message);
     return $response;
@@ -39,6 +44,9 @@ function imap_test($imap_stream, $string) {
 
 /**
  * Print the IMAP response to options.php
+ *
+ * @param array $response results of imap command
+ * @access private
  */
 function print_response($response) {
     foreach($response as $index=>$value) {
@@ -46,11 +54,22 @@ function print_response($response) {
             print_response($value);
         }
         else {
-            $value = preg_replace("/</", "&lt;", $value);
-            $value = preg_replace("/>/", "&gt;", $value);
-            print $value."<BR>\n";
+            print htmlspecialchars($value)."<br />\n";
         }
     }
 }
-                                                                                        
-?>
+
+/**
+ * Check if plugin is enabled
+ * @param string $plugin_name plugin name
+ * @return boolean
+ */
+function is_plugin_enabled($plugin_name) {
+  global $plugins;
+  if ( in_array($plugin_name,$plugins) ) {
+    return true;
+  } else {
+    return false;
+  }
+}
+?>
\ No newline at end of file