summaryrefslogtreecommitdiffstats
path: root/system/libraries
diff options
context:
space:
mode:
Diffstat (limited to 'system/libraries')
-rw-r--r--system/libraries/Email.php20
-rw-r--r--system/libraries/Xmlrpc.php2
2 files changed, 11 insertions, 11 deletions
diff --git a/system/libraries/Email.php b/system/libraries/Email.php
index 739b76ccb..9487ad486 100644
--- a/system/libraries/Email.php
+++ b/system/libraries/Email.php
@@ -710,39 +710,39 @@ class CI_Email {
/**
* Assign file attachments
*
- * @param string $filename
+ * @param string $file Can be local path, URL or buffered content
* @param string $disposition = 'attachment'
* @param string $newname = NULL
* @param string $mime = ''
* @return CI_Email
*/
- public function attach($filename, $disposition = '', $newname = NULL, $mime = '')
+ public function attach($file, $disposition = '', $newname = NULL, $mime = '')
{
if ($mime === '')
{
- if ( ! file_exists($filename))
+ if (strpos($file, '://') === FALSE && ! file_exists($file))
{
- $this->_set_error_message('lang:email_attachment_missing', $filename);
+ $this->_set_error_message('lang:email_attachment_missing', $file);
return FALSE;
}
- if ( ! $fp = fopen($filename, FOPEN_READ))
+ if ( ! $fp = @fopen($file, FOPEN_READ))
{
- $this->_set_error_message('lang:email_attachment_unreadable', $filename);
+ $this->_set_error_message('lang:email_attachment_unreadable', $file);
return FALSE;
}
$file_content = stream_get_contents($fp);
- $mime = $this->_mime_types(pathinfo($filename, PATHINFO_EXTENSION));
+ $mime = $this->_mime_types(pathinfo($file, PATHINFO_EXTENSION));
fclose($fp);
}
else
{
- $file_content =& $filename; // buffered file
+ $file_content =& $file; // buffered file
}
$this->_attachments[] = array(
- 'name' => array($filename, $newname),
+ 'name' => array($file, $newname),
'disposition' => empty($disposition) ? 'attachment' : $disposition, // Can also be 'inline' Not sure if it matters
'type' => $mime,
'content' => chunk_split(base64_encode($file_content))
@@ -2097,7 +2097,7 @@ class CI_Email {
*/
protected function _send_data($data)
{
- if ( ! fwrite($this->_smtp_connect, $data.$this->newline))
+ if (fwrite($this->_smtp_connect, $data.$this->newline) === FALSE)
{
$this->_set_error_message('lang:email_smtp_data_failure', $data);
return FALSE;
diff --git a/system/libraries/Xmlrpc.php b/system/libraries/Xmlrpc.php
index 2fd12599e..1f93e6981 100644
--- a/system/libraries/Xmlrpc.php
+++ b/system/libraries/Xmlrpc.php
@@ -724,7 +724,7 @@ class XML_RPC_Client extends CI_Xmlrpc
.'Content-Length: '.strlen($msg->payload).$r.$r
.$msg->payload;
- if ( ! fwrite($fp, $op, strlen($op)))
+ if (fwrite($fp, $op, strlen($op)) === FALSE)
{
error_log($this->xmlrpcstr['http_error']);
return new XML_RPC_Response(0, $this->xmlrpcerr['http_error'], $this->xmlrpcstr['http_error']);