X-Git-Url: https://vcs.fsf.org/?p=squirrelmail.git;a=blobdiff_plain;f=plugins%2Finfo%2Foptions.php;h=4887ecef227aa7cecde344b55bb19aac661dba5b;hp=57528633192ee334071a809a17d12da4e20d8824;hb=c4faef335b2362c81b8ebf026d4066c12d70536c;hpb=91e0dccca7b2452d8b450791cae3aa4125e8889e diff --git a/plugins/info/options.php b/plugins/info/options.php index 57528633..4887ecef 100644 --- a/plugins/info/options.php +++ b/plugins/info/options.php @@ -1,30 +1,32 @@ + * @copyright 1999-2020 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 */ -/** @ignore */ -define('SM_PATH','../../'); +/** + * Path for SquirrelMail required files. + * @ignore + */ +require('../../include/init.php'); /* 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/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'); +displayPageHeader($color); $mailbox = 'INBOX'; /** @@ -33,17 +35,13 @@ $mailbox = 'INBOX'; * prevent use of plugin if it is not enabled */ if (! is_plugin_enabled('info')) { - echo '

'. - _("Plugin is disabled."). - '

'; + error_box(_("Plugin is disabled.")); + // display footer (closes html) and stop script execution + $oTemplate->display('footer.tpl'); exit; } /* GLOBALS */ -sqgetGlobalVar('username', $username, SQ_SESSION); -sqgetGlobalVar('key', $key, SQ_COOKIE); -sqgetGlobalVar('onetimepad', $onetimepad, SQ_SESSION); - sqgetGlobalVar('submit', $submit, SQ_POST); for($i = 0; $i <= 9; $i++){ @@ -55,7 +53,8 @@ for($i = 0; $i <= 9; $i++){ /* END GLOBALS */ -$imap_stream = sqimap_login($username, $key, $imapServerAddress, $imapPort, 0); +global $imap_stream_options; // in case not defined in config +$imap_stream = sqimap_login($username, false, $imapServerAddress, $imapPort, 0, $imap_stream_options); $caps_array = get_caps($imap_stream); $list = array ('TEST_0', 'TEST_1', @@ -68,16 +67,16 @@ $list = array ('TEST_0', 'TEST_8', 'TEST_9'); -echo '
'._("IMAP server information")."

\n". - '
'. +echo '
'._("IMAP server information")."

\n". + '
'. '

\n". - '
\n". + '
\n". '
'. _("Server Capability response:"). "
\n"; foreach($caps_array[0] as $value) { - echo htmlspecialchars($value); + echo sm_encode_html_special_chars($value); } echo "
\n"; @@ -94,11 +93,11 @@ if (!isset($submit) || $submit == 'default') { } } else { - echo 'folder_prefix = ' . htmlspecialchars($folder_prefix)."
\n" . - 'default_charset = '.htmlspecialchars($default_charset)."\n"; + echo 'folder_prefix = ' . sm_encode_html_special_chars($folder_prefix)."
\n" . + 'default_charset = '.sm_encode_html_special_chars($default_charset)."\n"; } -echo "

\n"; +echo "

\n"; if ($submit == 'submit') { @@ -124,12 +123,12 @@ 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' => ""); } echo "
\n". - "
\n". + "
\n". '\n". @@ -148,12 +147,12 @@ foreach($type as $index=>$value) { addInput($index, $value, 60); } -echo "
'. _("Select"). ''._("Test Name"). ''._("IMAP command string")."

\n". - '
'. +echo "
\n". + '
'. addSubmit('submit','submit'). - addSubmit('clear','submit'). - addSubmit('default','submit'). - "

\n"; + addSubmit('clear','submit',array('id'=>'clear')). + addSubmit('default','submit',array('id'=>'default')). + "
\n"; $tests = array(); @@ -166,26 +165,45 @@ if ($submit == 'submit') { } } for ($i=0;$i\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 '
\n". '\n". '\n". - '\n"; + // imap_test function outputs imap command + $response = imap_test($imap_stream, $type[$tests[$i]]); + echo '\n". '
'.$tests[$i]."
'. - _("Request:")."
'. + _("Request:")."
'. _("Response:")."
'; print_response($response); - echo "

\n"; + echo "\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 ''. + _("Execution time:")."\n". + ''.sprintf(_("%s ms"),round((($endtime - $starttime)*1000),3))."\n"; + } + + echo "
\n"; } } - echo ''; - sqimap_logout($imap_stream); +echo ''; +sqimap_logout($imap_stream); /** * Optional hook in info plugin * * Hook allows attaching plugin to bottom of info plugin */ -do_hook('info_bottom'); +do_hook('info_bottom', $null); ?> - \ No newline at end of file +