* @copyright © 1999-2007 The SquirrelMail Project Team * @license http://opensource.org/licenses/gpl-license.php GNU Public License * @version $Id$ * @package plugins * @subpackage info */ /** * Path for SquirrelMail required files. * @ignore */ require('../../include/init.php'); /* SquirrelMail required files. */ require_once(SM_PATH . 'functions/imap_general.php'); require_once(SM_PATH . 'functions/forms.php'); require_once(SM_PATH . 'plugins/info/functions.php'); global $username, $color, $folder_prefix, $default_charset; $default_charset = strtoupper($default_charset); displayPageHeader($color, 'None'); $mailbox = 'INBOX'; /** * testing installation * * prevent use of plugin if it is not enabled */ if (! is_plugin_enabled('info')) { error_box(_("Plugin is disabled.")); // display footer (closes html) and stop script execution $oTemplate->display('footer.tpl'); exit; } /* GLOBALS */ sqgetGlobalVar('submit', $submit, SQ_POST); for($i = 0; $i <= 9; $i++){ $varc = 'CHECK_TEST_'.$i; sqgetGlobalVar($varc, $$varc, SQ_POST); $vart = 'TEST_'.$i; sqgetGlobalVar($vart, $$vart, SQ_POST); } /* END GLOBALS */ $imap_stream = sqimap_login($username, false, $imapServerAddress, $imapPort, 0); $caps_array = get_caps($imap_stream); $list = array ('TEST_0', 'TEST_1', 'TEST_2', 'TEST_3', 'TEST_4', 'TEST_5', 'TEST_6', 'TEST_7', 'TEST_8', 'TEST_9'); echo '
'._("IMAP server information")."

\n". ''. '\n". '\n"; // imap_test function outputs imap command $response = imap_test($imap_stream, $type[$tests[$i]]); echo '\n". '\n"; if (function_exists('microtime')) { // get script execution time list($usec, $sec) = explode(" ", microtime()); $endtime = (float)$sec + (float)$usec; // i18n: ms = short for miliseconds echo '\n". '\n"; } echo "

\n". '\n". '
'. _("Server Capability response:"). "
\n"; foreach($caps_array[0] as $value) { echo htmlspecialchars($value); } echo "
\n"; if (!isset($submit) || $submit == 'default') { 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."). "

\n". '

'. _("NOTE: These commands are live, any changes made will effect your current email account."). "


\n"; if (!isset($submit)) { $submit = ''; } } else { echo 'folder_prefix = ' . htmlspecialchars($folder_prefix)."
\n" . 'default_charset = '.htmlspecialchars($default_charset)."\n"; } echo "

\n"; if ($submit == 'submit') { $type = array(); for ($i=0;$i "SELECT $mailbox", 'TEST_1' => "STATUS $mailbox (MESSAGES RECENT)", 'TEST_2' => "EXAMINE $mailbox", 'TEST_3' => "SEARCH CHARSET \"$default_charset\" ALL *", 'TEST_4' => "THREAD REFERENCES $default_charset ALL", 'TEST_5' => "SORT (DATE) $default_charset ALL", 'TEST_6' => "FETCH 1:* (FLAGS BODY[HEADER.FIELDS (FROM DATE TO)])", 'TEST_7' => "LSUB \"$folder_prefix\" \"*%\"", 'TEST_8' => "LIST \"$folder_prefix\" \"*\"", 'TEST_9' => ""); } echo "
\n". "\n". '\n". '\n
'. _("Select"). ''._("Test Name"). ''._("IMAP command string")."
'; foreach($type as $index=>$value) { echo "
\n$index\n". addInput($index, $value, 60); } echo "

\n". '
'. addSubmit('submit','submit'). addSubmit('clear','submit',array('id'=>'clear')). addSubmit('default','submit',array('id'=>'default')). "

\n"; $tests = array(); if ($submit == 'submit') { foreach ($type as $index=>$value) { $check = "CHECK_".$index; if (isset($$check)) { $type[$index] = $$index; array_push($tests, $index); } } for ($i=0;$i\n". '
'.$tests[$i]."
'. _("Request:")."
'. _("Response:")."
'; print_response($response); echo "
'. _("Execution time:")."
'.sprintf(_("%s ms"),round((($endtime - $starttime)*1000),3))."

\n"; } } echo ''; sqimap_logout($imap_stream); /** * Optional hook in info plugin * * Hook allows attaching plugin to bottom of info plugin */ do_hook('info_bottom', $null); ?>