Document bad assumption
[squirrelmail.git] / class / deliver / Deliver.class.php
index 3207080793b666dd2bbe82409272d02d014cdd16..aa88eee68aae77f41412c98f672955bbc53b110c 100644 (file)
@@ -7,7 +7,7 @@
  * a delivery backend.
  *
  * @author Marc Groot Koerkamp
- * @copyright 1999-2012 The SquirrelMail Project Team
+ * @copyright 1999-2017 The SquirrelMail Project Team
  * @license http://opensource.org/licenses/gpl-license.php GNU Public License
  * @version $Id$
  * @package squirrelmail
@@ -90,7 +90,7 @@ class Deliver {
         //
         if ($reply_id) {
             global $imapConnection, $username, $imapServerAddress, 
-                   $imapPort, $mailbox;
+                   $imapPort, $imap_stream_options, $mailbox;
 
             // try our best to use an existing IMAP handle
             //
@@ -103,8 +103,8 @@ class Deliver {
 
             } else {
                 $close_imap_stream = TRUE;
-                $my_imap_stream = sqimap_login($username, FALSE,
-                                               $imapServerAddress, $imapPort, 0);
+                $my_imap_stream = sqimap_login($username, FALSE, $imapServerAddress,
+                                               $imapPort, 0, $imap_stream_options);
             }
 
             sqimap_mailbox_select($my_imap_stream, $mailbox);
@@ -437,16 +437,27 @@ class Deliver {
      *
      * This function is not yet implemented.
      * Reserved for extended functionality.
+     * UPDATE: It is implemented in Deliver_SMTP and Deliver_SendMail classes,
+     *         but it remains unimplemented in this base class (and thus not
+     *         in Deliver_IMAP or other child classes that don't define it)
+     *
+     * NOTE: some parameters are specific to the child class
+     *       that is implementing this method
      *
      * @param Message $message  Message object
+     * @param string  $domain
+     * @param integer $length
      * @param string  $host     host name or IP to connect to
+     * @param integer $port
      * @param string  $user     username to log into the SMTP server with
      * @param string  $pass     password to log into the SMTP server with
-     * @param integer $length
+     * @param boolean $authpop  whether or not to use POP-before-SMTP authorization
+     * @param string  $pop_host host name or IP to connect to for POP-before-SMTP authorization
+     * @param array   $stream_options Stream context options, see config_local.example.php for more details (OPTIONAL)
      *
      * @return handle $stream file handle resource to SMTP stream
      */
-    function initStream($message, $length=0, $host='', $port='', $user='', $pass='') {
+    function initStream($message, $domain, $length=0, $host='', $port='', $user='', $pass='', $authpop=false, $pop_host='', $stream_options=array()) {
         return $stream;
     }
 
@@ -545,7 +556,7 @@ class Deliver {
         $cnt = count($header);
         $hdr_s = '';
         for ($i = 0 ; $i < $cnt ; $i++)    {
-            $hdr_s .= $this->foldLine($header[$i]);
+            $hdr_s .= $this->foldLine($header[$i], 78);
         }
         $header = $hdr_s;
         $header .= $rn; /* One blank line to separate mimeheader and body-entity */
@@ -779,7 +790,7 @@ class Deliver {
             case 'From':
                 $hdr_s .= $header[$i];
                 break;
-            default: $hdr_s .= $this->foldLine($header[$i]); break;
+            default: $hdr_s .= $this->foldLine($header[$i], 78); break;
             }
         }
         $header = $hdr_s;
@@ -961,7 +972,7 @@ class Deliver {
                         // if we found the beginning of an encoded word,
                         // we want to break BEFORE the token
                         //
-                        if (preg_match('/^(=\?([^?]*)\?(Q|B)\?([^?]*)\?=)/i',
+                        if (preg_match('/^(=\?([^?]*)\?(Q|B)\?([^?]*)\?=)/Ui',
                                        substr($header, $pos))) {
                             $pos--;
                         }
@@ -982,7 +993,7 @@ class Deliver {
                         //
                         else if (strlen($header) > $hard_wrap
                          && ($end_pos = strpos(substr($header, $hard_wrap), '?=')) !== FALSE
-                         && preg_match('/(=\?([^?]*)\?(Q|B)\?([^?]*)\?=)$/i',
+                         && preg_match('/(=\?([^?]*)\?(Q|B)\?([^?]*)\?=)$/Ui',
                                        substr($header, 0, $hard_wrap + $end_pos + 2),
                                        $matches)) {