52 if (
$options & STREAM_REPORT_ERRORS) {
53 trigger_error(
'Only reading is supported', E_USER_WARNING);
60 parse_str(substr(
$path, 25), $this->params);
61 if (!isset($this->params[
'oleInstanceId'], $this->params[
'blockId'],
$GLOBALS[
'_OLE_INSTANCES'][$this->params[
'oleInstanceId']])) {
62 if (
$options & STREAM_REPORT_ERRORS) {
63 trigger_error(
'OLE stream not found', E_USER_WARNING);
68 $this->ole =
$GLOBALS[
'_OLE_INSTANCES'][$this->params[
'oleInstanceId']];
70 $blockId = $this->params[
'blockId'];
72 if (isset($this->params[
'size']) && $this->params[
'size'] < $this->ole->bigBlockThreshold && $blockId != $this->ole->root->startBlock) {
74 $rootPos = $this->ole->getBlockOffset($this->ole->root->startBlock);
75 while ($blockId != -2) {
76 $pos = $rootPos + $blockId * $this->ole->bigBlockSize;
77 $blockId = $this->ole->sbat[$blockId];
78 fseek($this->ole->_file_handle,
$pos);
79 $this->
data .= fread($this->ole->_file_handle, $this->ole->bigBlockSize);
83 while ($blockId != -2) {
84 $pos = $this->ole->getBlockOffset($blockId);
85 fseek($this->ole->_file_handle,
$pos);
86 $this->
data .= fread($this->ole->_file_handle, $this->ole->bigBlockSize);
87 $blockId = $this->ole->bbat[$blockId];
90 if (isset($this->params[
'size'])) {
91 $this->
data = substr($this->
data, 0, $this->params[
'size']);
122 $s = substr($this->
data, $this->pos, $count);
123 $this->pos += $count;
135 return $this->pos >= strlen($this->
data);
159 if ($whence == SEEK_SET && $offset >= 0) {
160 $this->pos = $offset;
161 } elseif ($whence == SEEK_CUR && -$offset <= $this->pos) {
162 $this->pos += $offset;
163 } elseif ($whence == SEEK_END && -$offset <= count($this->
data)) {
164 $this->pos = strlen($this->
data) + $offset;
181 'size' => strlen($this->
data),
$GLOBALS['_OLE_INSTANCES']
stream_read($count)
Implements support for fread(), fgets() etc.
stream_seek($offset, $whence)
Implements support for fseek().
stream_close()
Implements support for fclose().
stream_eof()
Implements support for feof().
stream_tell()
Returns the position of the file pointer, i.e.
stream_stat()
Implements support for fstat().
stream_open($path, $mode, $options, &$openedPath)
Implements support for fopen().