summaryrefslogtreecommitdiffstats
path: root/system
diff options
context:
space:
mode:
authorAndrey Andreev <narf@bofh.bg>2012-10-27 00:36:51 +0200
committerAndrey Andreev <narf@bofh.bg>2012-10-27 00:36:51 +0200
commitb8f9a15a156a74f788c04b463304cf310ce8ba80 (patch)
tree5503e732eb3c417a149b0e780970c3d7d6e66342 /system
parent29d909d5d1a14efc2e316650946bf43ddf03f1fd (diff)
Unify Email attachment values into a single array and fix a bug in the new buffer attachment feature
Diffstat (limited to 'system')
-rw-r--r--system/libraries/Email.php36
1 files changed, 18 insertions, 18 deletions
diff --git a/system/libraries/Email.php b/system/libraries/Email.php
index 83b442f58..9207fc9f0 100644
--- a/system/libraries/Email.php
+++ b/system/libraries/Email.php
@@ -81,9 +81,7 @@ class CI_Email {
protected $_cc_array = array();
protected $_bcc_array = array();
protected $_headers = array();
- protected $_attach_name = array();
- protected $_attach_type = array();
- protected $_attach_disp = array();
+ protected $_attachments = array();
protected $_protocols = array('mail', 'sendmail', 'smtp');
protected $_base_charsets = array('us-ascii', 'iso-2022-'); // 7-bit charsets (excluding language suffix)
protected $_bit_depths = array('7bit', '8bit');
@@ -176,9 +174,7 @@ class CI_Email {
if ($clear_attachments !== FALSE)
{
- $this->_attach_name = array();
- $this->_attach_type = array();
- $this->_attach_disp = array();
+ $this->_attachments = array();
}
return $this;
@@ -415,9 +411,12 @@ class CI_Email {
*/
public function attach($filename, $disposition = '', $newname = NULL, $mime = '')
{
- $this->_attach_name[] = array($filename, $newname);
- $this->_attach_disp[] = empty($disposition) ? 'attachment' : $disposition; // Can also be 'inline' Not sure if it matters
- $this->_attach_type[] = $mime;
+ $this->_attachments[] = array(
+ 'name' => array($filename, $newname),
+ 'disposition' => empty($disposition) ? 'attachment' : $disposition, // Can also be 'inline' Not sure if it matters
+ 'type' => $mime
+ );
+
return $this;
}
@@ -635,9 +634,9 @@ class CI_Email {
{
if ($this->mailtype === 'html')
{
- return (count($this->_attach_name) === 0) ? 'html' : 'html-attach';
+ return (count($this->_attachments) === 0) ? 'html' : 'html-attach';
}
- elseif ($this->mailtype === 'text' && count($this->_attach_name) > 0)
+ elseif ($this->mailtype === 'text' && count($this->_attachments) > 0)
{
return 'plain-attach';
}
@@ -1045,14 +1044,15 @@ class CI_Email {
}
$attachment = array();
- for ($i = 0, $c = count($this->_attach_name), $z = 0; $i < $c; $i++)
+ for ($i = 0, $c = count($this->_attachments), $z = 0; $i < $c; $i++)
{
- $filename = $this->_attach_name[$i][0];
- $basename = is_null($this->_attach_name[$i][1]) ? basename($filename) : $this->_attach_name[$i][1];
- $ctype = $this->_attach_type[$i];
+ $filename = $this->_attachments[$i]['name'][0];
+ $basename = is_null($this->_attachments[$i]['name'][1])
+ ? basename($filename) : $this->_attachments[$i]['name'][1];
+ $ctype = $this->_attachments[$i]['type'];
$file_content = '';
- if ($this->_attach_type[$i] === '')
+ if ($ctype === '')
{
if ( ! file_exists($filename))
{
@@ -1074,13 +1074,13 @@ class CI_Email {
}
else
{
- $file_content =& $this->_attach_content[$i];
+ $file_content =& $this->_attachments[$i]['name'][0];
}
$attachment[$z++] = '--'.$this->_atc_boundary.$this->newline
.'Content-type: '.$ctype.'; '
.'name="'.$basename.'"'.$this->newline
- .'Content-Disposition: '.$this->_attach_disp[$i].';'.$this->newline
+ .'Content-Disposition: '.$this->_attachments[$i]['disposition'].';'.$this->newline
.'Content-Transfer-Encoding: base64'.$this->newline;
$attachment[$z++] = chunk_split(base64_encode($file_content));