-<?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 third prints the results of the IMAP command
* to options.php.
- * by: Jason Munro jason@stdbev.com
*
- * $Id$
+ * @copyright (c) 1999-2004 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);
/**
* 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 the IMAP response to options.php
+ *
+ * @param array $response results of imap command
+ * @access private
*/
function print_response($response) {
foreach($response as $index=>$value) {
}
}
}
-
-?>
+
+/**
+ * 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
<?PHP
-
/**
* options page for IMAP info plugin
- * Copyright (c) 1999-2004 The SquirrelMail Project Team
- * Licensed under the GNU GPL. For full terms see the file COPYING.
- *
+ *
* This is where it all happens :)
- *
- * Written by: Jason Munro
- * jason@stdbev.com
*
- * $Id$
+ * @copyright (c) 1999-2004 The SquirrelMail Project Team
+ * @license http://opensource.org/licenses/gpl-license.php GNU Public License
+ * @version $Id$
+ * @author Jason Munro jason@stdbev.com
* @package plugins
* @subpackage info
*/
displayPageHeader($color, 'None');
$mailbox = 'INBOX';
+/**
+ * testing installation
+ *
+ * prevent use of plugin if it is not enabled
+ */
+if (! is_plugin_enabled('info')) {
+ echo "<p align=\"center\"><big>";
+ echo _("Plugin is disabled.");
+ echo "</big></p></body></html>";
+ exit;
+}
+
/* GLOBALS */
-sqgetGlobalVar('username', $username, SQ_SESSION);
-sqgetGlobalVar('key', $key, SQ_COOKIE);
-sqgetGlobalVar('onetimepad', $onetimepad, SQ_SESSION);
+sqgetGlobalVar('username', $username, SQ_SESSION);
+sqgetGlobalVar('key', $key, SQ_COOKIE);
+sqgetGlobalVar('onetimepad', $onetimepad, SQ_SESSION);
sqgetGlobalVar('submit', $submit, SQ_POST);
'TEST_8',
'TEST_9');
-print "<BR><CENTER><B>IMAP server information</B></CENTER><BR>\n";
-print "<CENTER><TABLE BGCOLOR=".$color[3]." WIDTH=\"100%\" BORDER=1 CELLPADDING=2><TR><TD BGCOLOR=".$color[3]."><BR>\n";
-print "<CENTER><TABLE WIDTH=\"95%\" BORDER=1 BGCOLOR=".$color[3].">\n";
-print "<TR><TD BGCOLOR=".$color[4]."><B>Server Capability response:</B><BR>\n";
+print "<br /><center><b>";
+echo _("IMAP server information");
+print "</b></center><br />\n";
+print "<center><table bgcolor=\"".$color[3]."\" width=\"100%\" border=\"1\" cellpadding=\"2\">";
+print "<tr><td bgcolor=\"".$color[3]."\"><br />\n";
+print "<center><table width=\"95%\" border=\"1\" bgcolor=\"".$color[3]."\">\n";
+print "<tr><td bgcolor=\"".$color[4]."\"><b>";
+echo _("Server Capability response:");
+print "</b><br />\n";
foreach($caps_array[0] as $value) {
print htmlspecialchars($value);
}
-print "</TD></TR><TR><TD>\n";
+print "</td></tr><tr><td>\n";
if (!isset($submit) || $submit == 'default') {
- print "<br><small><font color=".$color[6].">Select the IMAP commands you would like to run.
- Most commands require a selected mailbox so the select command is already setup.
- You can clear all the commands and test your own IMAP command strings. The commands are
- executed in order. The default values are simple IMAP commands using your default_charset
- and folder_prefix from SquirrelMail when needed.<br><br>
- <b><center>NOTE: These commands are live, any changes made will effect your current
- email account.</b></center></font></small><br>\n";
+ print "<br /><p><small><font color=\"".$color[6]."\">";
+ echo _("Select the IMAP commands you would like to run. Most commands require a selected mailbox so the select command is already setup. You can clear all the commands and test your own IMAP command strings. The commands are executed in order. The default values are simple IMAP commands using your default_charset and folder_prefix from SquirrelMail when needed.");
+ echo "</font></small></p>\n";
+ echo "<p align=\"center\"><small><b>";
+ echo _("NOTE: These commands are live, any changes made will effect your current email account.");
+ echo "</b></small></p><br />\n";
if (!isset($submit)) {
$submit = '';
}
'TEST_9' => "");
}
-print "<FORM ACTION=\"options.php\" METHOD=POST>\n";
-print "<CENTER><TABLE BORDER=1>\n";
-print "<TR><TH>Select</TH><TH>Test Name</TH><TH>IMAP command string</TH>\n";
-print "</TR><TR><TD>\n";
+print "<form action=\"options.php\" method=\"post\">\n";
+print "<center><table border=\"1\">\n";
+echo "<tr><th>" . _("Select") .
+ "</th><th>" . _("Test Name") .
+ "</th><th>" . _("IMAP command string") . "</th></tr>\n";
+print "<tr><td>";
foreach($type as $index=>$value) {
- print "</TD></TR><TR><TD WIDTH=\"10%\"><INPUT TYPE=CHECKBOX VALUE=1 NAME=CHECK_$index";
+ print "</td></tr>\n<tr><td width=\"10%\">\n<input type=\"checkbox\" value=\"1\" name=\"CHECK_$index\"";
if ($index == 'TEST_0' && ($submit == 'default' || $submit == '')) {
- print " CHECKED";
+ print " checked";
}
$check = "CHECK_".$index;
if (isset($$check) && $submit != 'clear' && $submit != 'default') {
- print " CHECKED";
+ print " checked";
}
- print "></TD><TD WIDTH=\"30%\">$index</TD><TD WIDTH=\"60%\">\n";
+ print "></td><td width=\"30%\">$index</td><td width=\"60%\">\n";
print addInput($index, $value, 60);
}
addSubmit('submit','submit').
addSubmit('clear','submit').
addSubmit('default','submit').
- "</center><br>\n";
+ "</center><br></form>\n";
$tests = array();
}
}
for ($i=0;$i<count($tests);$i++) {
- print "<CENTER><TABLE WIDTH=\"95%\" BORDER=0 BGCOLOR=".$color[4].">\n";
- print "<TR><TD><B>".$tests[$i]."</B></TD><TR>";
- print "<TR><TD><SMALL><B><FONT COLOR=".$color[7].
- ">Request:</FONT></SMALL></B></TD></TR>\n";
+ print "<center><table width=\"95%\" border=\"0\" bgcolor=\"".$color[4]."\">\n";
+ print "<tr><td><b>".$tests[$i]."</b></td></tr>\n";
+ print "<tr><td><small><b><font color=\"".$color[7]."\">";
+ echo _("Request:") . "</font></b></small></td></tr>\n";
$response = imap_test($imap_stream, $type[$tests[$i]]);
- print "<TR><TD><SMALL><B><FONT COLOR=".$color[7].
- ">Response:</FONT></SMALL></B></TD></TR>\n";
- print "<TR><TD>";
+ print "<tr><td><small><b><font color=\"".$color[7]."\">";
+ echo _("Response:") . "</font></b></small></td></tr>\n";
+ print "<tr><td>";
print_response($response);
- print "</TD><TR></TABLE></CENTER><BR>\n";
+ print "</td></tr></table></center><br />\n";
}
}
- print "</TD></TR></TABLE></CENTER></BODY></HTML>";
+ print "</td></tr></table></center>";
sqimap_logout($imap_stream);
- do_hook('info_bottom');
+
+/**
+ * Optional hook in info plugin
+ *
+ * Hook allows attaching plugin to bottom of info plugin
+ */
+do_hook('info_bottom');
?>
+</body></html>
\ No newline at end of file