X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=functions%2Fimap_general.php;h=023401a3ad40735cbacc51857ef7b463df372241;hb=d20dfddde2a2a592e8cefc9a7e89f2eaba8673cd;hp=d03cebac381a37cf36ecc598a700dc085da4ceab;hpb=edde1f5c1a79d459b1c5f060a666edc82424bd27;p=squirrelmail.git
diff --git a/functions/imap_general.php b/functions/imap_general.php
index d03cebac..023401a3 100755
--- a/functions/imap_general.php
+++ b/functions/imap_general.php
@@ -3,25 +3,24 @@
/**
* imap_general.php
*
- * Copyright (c) 1999-2005 The SquirrelMail Project Team
- * Licensed under the GNU GPL. For full terms see the file COPYING.
- *
- * This implements all functions that do general imap functions.
+ * This implements all functions that do general IMAP functions.
*
+ * @copyright 1999-2012 The SquirrelMail Project Team
+ * @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @version $Id$
* @package squirrelmail
* @subpackage imap
*/
/** Includes.. */
-require_once(SM_PATH . 'functions/page_header.php');
-require_once(SM_PATH . 'functions/auth.php');
+
+require_once(SM_PATH . 'functions/rfc822address.php');
/**
* Generates a new session ID by incrementing the last one used;
* this ensures that each command has a unique ID.
- * @param bool $unique_id (since 1.3.0) controls use of unique
+ * @param bool $unique_id (since 1.3.0) controls use of unique
* identifiers/message sequence numbers in IMAP commands. See IMAP
* rfc 'UID command' chapter.
* @return string IMAP session id of the form 'A000'.
@@ -40,15 +39,13 @@ function sqimap_session_id($unique_id = FALSE) {
/**
* Both send a command and accept the result from the command.
* This is to allow proper session number handling.
- * @param resource $imap_stream imap connection resource
+ * @param stream $imap_stream imap connection resource
* @param string $query imap command
* @param boolean $handle_errors see sqimap_retrieve_imap_response()
- * @param mixed $response
- * @param mixed $message
- * @param boolean $unique_id (since 1.3.0) controls use of unique
- * identifiers/message sequence numbers in IMAP commands. See IMAP
- * rfc 'UID command' chapter.
- * @return mixed returns false on imap error. displays error message
+ * @param array $response
+ * @param array $message
+ * @param boolean $unique_id (since 1.3.0) see sqimap_session_id().
+ * @return mixed returns false on imap error. displays error message
* if imap stream is not available.
* @since 1.2.3
*/
@@ -63,31 +60,31 @@ function sqimap_run_command_list ($imap_stream, $query, $handle_errors, &$respon
$message = $message[$tag];
$response = $response[$tag];
return $read[$tag];
+//FIXME: obey $handle_errors below!
} else {
global $squirrelmail_language, $color;
set_up_language($squirrelmail_language);
- require_once(SM_PATH . 'functions/display_messages.php');
+//FIXME: NO HTML IN CORE!
$string = "\n" .
- _("ERROR : No available imapstream.") .
+ _("ERROR: No available IMAP stream.") .
+//FIXME: NO HTML IN CORE!
"\n";
- error_box($string,$color);
+ error_box($string);
return false;
}
}
/**
- * @param resource $imap_stream imap connection resource
+ * @param stream $imap_stream imap connection resource
* @param string $query imap command
* @param boolean $handle_errors see sqimap_retrieve_imap_response()
- * @param mixed $response
- * @param mixed $message
- * @param boolean $unique_id (since 1.3.0) controls use of unique
- * identifiers/message sequence numbers in IMAP commands. See IMAP
- * rfc 'UID command' chapter.
- * @param mixed $filter (since 1.4.1 and 1.5.0)
- * @param mixed $outputstream (since 1.4.1 and 1.5.0)
- * @param mixed $no_return (since 1.4.1 and 1.5.0)
- * @return mixed returns false on imap error. displays error message
+ * @param array $response empty string, if return = false
+ * @param array $message empty string, if return = false
+ * @param boolean $unique_id (since 1.3.0) see sqimap_session_id()
+ * @param boolean $filter (since 1.4.1 and 1.5.0) see sqimap_fread()
+ * @param mixed $outputstream (since 1.4.1 and 1.5.0) see sqimap_fread()
+ * @param boolean $no_return (since 1.4.1 and 1.5.0) see sqimap_fread()
+ * @return mixed returns false on imap error. displays error message
* if imap stream is not available.
* @since 1.2.3
*/
@@ -102,7 +99,7 @@ function sqimap_run_command ($imap_stream, $query, $handle_errors, &$response,
$read = sqimap_read_data ($imap_stream, $tag, $handle_errors, $response,
$message, $query,$filter,$outputstream,$no_return);
- if (empty($read)) { //Imap server dropped its connection
+ if (empty($read)) { //IMAP server dropped its connection
$response = '';
$message = '';
return false;
@@ -116,14 +113,16 @@ function sqimap_run_command ($imap_stream, $query, $handle_errors, &$response,
} else {
return $read[$tag];
}
+//FIXME: obey $handle_errors below!
} else {
global $squirrelmail_language, $color;
set_up_language($squirrelmail_language);
- require_once(SM_PATH . 'functions/display_messages.php');
+//FIXME: NO HTML IN CORE!
$string = "\n" .
- _("ERROR : No available imapstream.") .
+ _("ERROR: No available IMAP stream.") .
+//FIXME: NO HTML IN CORE!
"\n";
- error_box($string,$color);
+ error_box($string);
return false;
}
}
@@ -132,7 +131,7 @@ function sqimap_run_command ($imap_stream, $query, $handle_errors, &$response,
* @param mixed $new_query
* @param string $tag
* @param array $aQuery
- * @param boolean $unique_id
+ * @param boolean $unique_id see sqimap_session_id()
* @since 1.5.0
*/
function sqimap_prepare_pipelined_query($new_query,&$tag,&$aQuery,$unique_id) {
@@ -144,15 +143,15 @@ function sqimap_prepare_pipelined_query($new_query,&$tag,&$aQuery,$unique_id) {
}
/**
- * @param stream $imap_stream
+ * @param stream $imap_stream imap stream
* @param array $aQueryList
* @param boolean $handle_errors
* @param array $aServerResponse
* @param array $aServerMessage
- * @param boolean $unique_id
- * @param mixed $filter see sqimap_retrieve_imap_response()
- * @param mixed $outputstream see sqimap_retrieve_imap_response()
- * @param mixed $no_return see sqimap_retrieve_imap_response()
+ * @param boolean $unique_id see sqimap_session_id()
+ * @param boolean $filter see sqimap_fread()
+ * @param mixed $outputstream see sqimap_fread()
+ * @param boolean $no_return see sqimap_fread()
* @since 1.5.0
*/
function sqimap_run_pipelined_command ($imap_stream, $aQueryList, $handle_errors,
@@ -161,9 +160,9 @@ function sqimap_run_pipelined_command ($imap_stream, $aQueryList, $handle_errors
$aResponse = false;
/*
- Do not fire all calls at once to the imap-server but split the calls up
+ Do not fire all calls at once to the IMAP server but split the calls up
in portions of $iChunkSize. If we do not do that I think we misbehave as
- IMAP client or should handle BYE calls if the IMAP-server drops the
+ IMAP client or should handle BYE calls if the IMAP server drops the
connection because the number of queries is to large. This isn't tested
but a wild guess how it could work in the field.
@@ -219,9 +218,9 @@ function sqimap_run_pipelined_command ($imap_stream, $aQueryList, $handle_errors
}
/**
- * Custom fgets function: gets a line from the IMAP-server,
+ * Custom fgets function: gets a line from the IMAP server,
* no matter how big it may be.
- * @param stream imap_stream the stream to read from
+ * @param stream $imap_stream the stream to read from
* @return string a line
* @since 1.2.8
*/
@@ -248,9 +247,9 @@ function sqimap_fgets($imap_stream) {
/**
* @param stream $imap_stream
* @param integer $iSize
- * @param mixed $filter see sqimap_retrieve_imap_response()
- * @param mixed $outputstream see sqimap_retrieve_imap_response()
- * @param mixed $no_return see sqimap_retrieve_imap_response()
+ * @param boolean $filter
+ * @param mixed $outputstream stream or 'php://stdout' string
+ * @param boolean $no_return controls data returned by function
* @return string
* @since 1.4.1
*/
@@ -310,16 +309,23 @@ function sqimap_fread($imap_stream,$iSize,$filter=false,
/**
* Obsolete function, inform plugins that use it
+ * @param stream $imap_stream
+ * @param string $tag
+ * @param boolean $handle_errors
+ * @param array $response
+ * @param array $message
+ * @param string $query
* @since 1.1.3
* @deprecated (since 1.5.0) use sqimap_run_command or sqimap_run_command_list instead
*/
function sqimap_read_data_list($imap_stream, $tag, $handle_errors,
&$response, &$message, $query = '') {
- global $color, $squirrelmail_language;
+ global $color, $oTemplate, $squirrelmail_language;
set_up_language($squirrelmail_language);
- require_once(SM_PATH . 'functions/display_messages.php');
+//FIXME: NO HTML IN CORE!
$string = "\n" .
- _("ERROR : Bad function call.") .
+ _("ERROR: Bad function call.") .
+//FIXME: NO HTML IN CORE!
"
\n" .
_("Reason:") . ' '.
'There is a plugin installed which make use of the
' .
@@ -327,14 +333,15 @@ function sqimap_read_data_list($imap_stream, $tag, $handle_errors,
'Please adapt the installed plugin and let it use
'.
'sqimap_run_command or sqimap_run_command_list instead
'.
'The following query was issued:
'.
+//FIXME: NO HTML IN CORE!
htmlspecialchars($query) . '
' . "
\n";
- error_box($string,$color);
- echo '