X-Git-Url: https://vcs.fsf.org/?p=squirrelmail.git;a=blobdiff_plain;f=plugins%2Finfo%2Foptions.php;h=5489441e17d9e7a9b9cead3c176296b164508d70;hp=48427e94edd33d966f98cce195d524c5d3c358ce;hb=a8e021906ff27da1e5ca6164d9cb212a52d50d7c;hpb=6a85a764b1f36c8689597cf67d6f7ce71a2c8e81 diff --git a/plugins/info/options.php b/plugins/info/options.php index 48427e94..5489441e 100644 --- a/plugins/info/options.php +++ b/plugins/info/options.php @@ -1,24 +1,26 @@ - + * @copyright © 1999-2006 The SquirrelMail Project Team + * @license http://opensource.org/licenses/gpl-license.php GNU Public License + * @version $Id$ + * @package plugins + * @subpackage info */ +/** @ignore */ define('SM_PATH','../../'); /* SquirrelMail required files. */ require_once(SM_PATH . 'include/validate.php'); require_once(SM_PATH . 'functions/page_header.php'); require_once(SM_PATH . 'functions/imap.php'); +require_once(SM_PATH . 'functions/forms.php'); require_once(SM_PATH . 'plugins/info/functions.php'); global $username, $color, $folder_prefix, $default_charset; @@ -26,32 +28,36 @@ $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."),$color); + echo ''; + exit; +} + /* GLOBALS */ -$username = $_SESSION['username']; -$key = $_COOKIE['key']; -$onetimepad = $_SESSION['onetimepad']; +sqgetGlobalVar('username', $username, SQ_SESSION); +sqgetGlobalVar('key', $key, SQ_COOKIE); +sqgetGlobalVar('onetimepad', $onetimepad, SQ_SESSION); -if(isset($_POST['submit'])) { - $submit = $_POST['submit']; -} +sqgetGlobalVar('submit', $submit, SQ_POST); for($i = 0; $i <= 9; $i++){ - if(isset($_POST["CHECK_TEST_$i"])) { - $var = "CHECK_TEST_$i"; - $$var = $_POST["CHECK_TEST_$i"]; - } - if(isset($_POST["TEST_$i"])) { - $var = "TEST_$i"; - $$var = $_POST["TEST_$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, $key, $imapServerAddress, $imapPort, 0); $caps_array = get_caps($imap_stream); -$list = array ( - 'TEST_0', +$list = array ('TEST_0', 'TEST_1', 'TEST_2', 'TEST_3', @@ -62,29 +68,37 @@ $list = array ( 'TEST_8', 'TEST_9'); -print "
IMAP server information

\n"; -print "

\n"; -print "
\n"; -print "\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 "
Server Capability response:
\n"; +echo '
'._("IMAP server information")."

\n". + ''. + '

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

NOTE: These commands are live, any changes made will effect your current email account.

\n"; + 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 { - print "folder_prefix = $folder_prefix
\n"; - print "default_charset = $default_charset\n"; + echo 'folder_prefix = ' . htmlspecialchars($folder_prefix)."
\n" . + 'default_charset = '.htmlspecialchars($default_charset)."\n"; } -print "

\n"; +echo "

\n"; if ($submit == 'submit') { @@ -110,32 +124,36 @@ elseif (!$submit || $submit == 'default') { '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_8' => "LIST \"$folder_prefix\" \"*\"", 'TEST_9' => ""); } -print "
\n"; -print "
\n"; -print "\n"; -print "
SelectTest NameIMAP command string
\n"; +echo "\n". + "\n". + '\n". + '\n
'. _("Select"). + ''._("Test Name"). + ''._("IMAP command string")."
'; foreach($type as $index=>$value) { - print "
\n$index\n"; - print "\n"; + echo " />$index\n". + addInput($index, $value, 60); } -print "

\n"; -print "
\n"; -print "\n"; -print "

\n"; +echo "

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

\n"; $tests = array(); @@ -144,23 +162,49 @@ if ($submit == 'submit') { $check = "CHECK_".$index; if (isset($$check)) { $type[$index] = $$index; - array_push($tests, $index); + array_push($tests, $index); } } for ($i=0;$i\n"; - print ""; - print "\n"; + // make sure that microtime function is available before it is called + if (function_exists('microtime')) { + list($usec, $sec) = explode(" ", microtime()); + $starttime = (float)$sec + (float)$usec; + } + + echo '
".$tests[$i]."
Request:
\n". + '\n". + '\n"; + // imap_test function outputs imap command $response = imap_test($imap_stream, $type[$tests[$i]]); - print "\n"; - print "\n". + '
'.$tests[$i]."
'. + _("Request:")."
Response:
"; + echo '
'. + _("Response:")."
'; print_response($response); - print "

\n"; + echo "
'. + _("Execution time:")."
'.sprintf(_("%s ms"),round((($endtime - $starttime)*1000),3))."

\n"; } } - print "
"; - sqimap_logout($imap_stream); - do_hook('info_bottom'); +echo ''; +sqimap_logout($imap_stream); + +/** + * Optional hook in info plugin + * + * Hook allows attaching plugin to bottom of info plugin + */ +do_hook('info_bottom'); ?> + \ No newline at end of file