Go to the documentation of this file.00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 require_once dirname(__FILE__).'/class.ilBMFBase.php';
00023
00036 class ilBMFValue
00037 {
00043 var $value = NULL;
00044
00049 var $name = '';
00050
00055 var $type = '';
00056
00062 var $namespace = '';
00063 var $type_namespace = '';
00064
00065 var $attributes = array();
00066
00071 var $arrayType = '';
00072
00073 var $options = array();
00074
00075 var $nqn;
00076 var $tqn;
00084 function ilBMFValue($name = '', $type = false, $value=NULL, $attributes = array())
00085 {
00086
00087 $this->nqn =& new ilBMFQName($name);
00088 $this->name = $this->nqn->name;
00089 $this->namespace = $this->nqn->namespace;
00090 $this->tqn =& new ilBMFQName($type);
00091 $this->type = $this->tqn->name;
00092 $this->type_prefix = $this->tqn->ns;
00093 $this->type_namespace = $this->tqn->namespace;
00094 $this->value =& $value;
00095 $this->attributes = $attributes;
00096 }
00097
00103 function &serialize(&$serializer)
00104 {
00105 return $serializer->_serializeValue($this->value, $this->name, $this->type, $this->namespace, $this->type_namespace, $this->options, $this->attributes, $this->arrayType);
00106 }
00107 }
00108
00109
00124 class SOAP_Header extends ilBMFValue
00125 {
00126
00136 function SOAP_Header($name = '', $type, $value,
00137 $mustunderstand = 0,
00138 $actor = 'http://schemas.xmlsoap.org/soap/actor/next')
00139 {
00140 parent::ilBMFValue($name, $type, $value);
00141 $this->attributes['SOAP-ENV:actor'] = $actor;
00142 $this->attributes['SOAP-ENV:mustUnderstand'] = (int)$mustunderstand;
00143 }
00144 }
00145
00157 class SOAP_Attachment extends ilBMFValue
00158 {
00159
00167 function SOAP_Attachment($name = '', $type = 'application/octet-stream',
00168 $filename, $file=NULL)
00169 {
00170 global $SOAP_options;
00171 if (!isset($SOAP_options['Mime'])) {
00172 return PEAR::raiseError('Mail_mime is not installed, unable to support SOAP Attachements');
00173 }
00174 parent::ilBMFValue($name, NULL, NULL);
00175
00176 $filedata = ($file === NULL) ? $this->_file2str($filename) : $file;
00177 $filename = basename($filename);
00178 if (PEAR::isError($filedata)) {
00179 return $filedata;
00180 }
00181
00182 $cid = md5(uniqid(time()));
00183
00184 $this->attributes['href'] = 'cid:'.$cid;
00185
00186 $this->options['attachment'] = array(
00187 'body' => $filedata,
00188 'disposition' => $filename,
00189 'content_type' => $type,
00190 'encoding' => 'base64',
00191 'cid' => $cid
00192 );
00193 }
00194
00195
00196
00197
00198
00199
00200
00201 function & _file2str($file_name)
00202 {
00203 if (!is_readable($file_name)) {
00204 return PEAR::raiseError('File is not readable ' . $file_name);
00205 }
00206 if (!$fd = fopen($file_name, 'rb')) {
00207 return PEAR::raiseError('Could not open ' . $file_name);
00208 }
00209 $cont = fread($fd, filesize($file_name));
00210 fclose($fd);
00211 return $cont;
00212 }
00213 }
00214 ?>