Inheritance diagram for SOAP_Attachment:
Collaboration diagram for SOAP_Attachment:Public Member Functions | |
| SOAP_Attachment ($name= '', $type= 'application/octet-stream', $filename, $file=null) | |
| Constructor. | |
| _file2str ($file_name) | |
| Returns the contents of the given file name as string. | |
Definition at line 176 of file class.ilBMFValue.php.
| SOAP_Attachment::_file2str | ( | $ | file_name | ) |
Returns the contents of the given file name as string.
private
| string | $file_name The file location. |
Definition at line 224 of file class.ilBMFValue.php.
References $file_name.
Referenced by SOAP_Attachment().
{
if (!is_readable($file_name)) {
return PEAR::raiseError('File is not readable: ' . $file_name);
}
if (function_exists('file_get_contents')) {
return file_get_contents($file_name);
}
if (!$fd = fopen($file_name, 'rb')) {
return PEAR::raiseError('Could not open ' . $file_name);
}
$cont = fread($fd, filesize($file_name));
fclose($fd);
return $cont;
}
Here is the caller graph for this function:| SOAP_Attachment::SOAP_Attachment | ( | $ | name = '', |
|
| $ | type = 'application/octet-stream', |
|||
| $ | filename, | |||
| $ | file = null | |||
| ) |
Constructor.
| string | $name Name of the SOAP value <value_name> | |
| string | $type The attachment's MIME type. | |
| string | $filename The attachment's file name. Ignored if $file is provide. | |
| string | $file The attachment data. |
Definition at line 187 of file class.ilBMFValue.php.
References $file, $filename, $GLOBALS, ilBMFValue::$name, ilBMFValue::$type, _file2str(), and ilBMFValue::ilBMFValue().
{
parent::ilBMFValue($name, null, null);
if (!isset($GLOBALS['SOAP_options']['Mime'])) {
$this->options['attachment'] = PEAR::raiseError('Mail_mime is not installed, unable to support SOAP Attachements');
return;
}
$filedata = ($file === null) ? $this->_file2str($filename) : $file;
$filename = basename($filename);
if (PEAR::isError($filedata)) {
$this->options['attachment'] = $filedata;
return;
}
$cid = md5(uniqid(time()));
$this->attributes['href'] = 'cid:' . $cid;
$this->options['attachment'] = array('body' => $filedata,
'disposition' => $filename,
'content_type' => $type,
'encoding' => 'base64',
'cid' => $cid);
}
Here is the call graph for this function:
1.7.1