X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=plugins%2Finfo%2Ffunctions.php;h=4b7df25c25f1323fcb4911250b7c3264ee1b4c85;hb=d05101b81527c04af28acda57b823d0e1d811e4a;hp=40a0a69dffa65ae72b01e9d98c7b13f44f434184;hpb=6a85a764b1f36c8689597cf67d6f7ce71a2c8e81;p=squirrelmail.git diff --git a/plugins/info/functions.php b/plugins/info/functions.php index 40a0a69d..4b7df25c 100644 --- a/plugins/info/functions.php +++ b/plugins/info/functions.php @@ -1,53 +1,61 @@ - + * @copyright © 1999-2007 The SquirrelMail Project Team + * @license http://opensource.org/licenses/gpl-license.php GNU Public License + * @version $Id$ + * @package plugins + * @subpackage info */ +/** + * Get the IMAP capabilities + * + * @param mixed $imap_stream + * @return array + * @access private + */ function get_caps($imap_stream) { - $sid = sqimap_session_id(); - $query = "$sid CAPABILITY\r\n"; - fputs ($imap_stream, $query); - $responses = sqimap_read_data_list($imap_stream, $sid, true, $responses, $message); - return $responses; + 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; - $message = ''; - $responses = array (); - $sid = sqimap_session_id(); - $results = array(); - $query = "$sid ".trim($string)."\r\n"; - print "".$query.""; - fputs ($imap_stream, $query); - $response = sqimap_read_data_list($imap_stream, $sid, false, $responses, $message); - array_push($response, $message); + print "".htmlspecialchars($string).""; + $response = sqimap_run_command_list($imap_stream, trim($string),false, $responses, $message,false); + array_push($response, $responses . ' ' .$message); return $response; } +/** + * 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) { + foreach($response as $value) { if (is_array($value)) { print_response($value); } else { - $value = preg_replace("//", ">", $value); - print $value."
\n"; + print htmlspecialchars($value)."
\n"; } } } - -?>