Exemplo n.º 1
0
 public function stream_open($path, $mode, $options, &$opened_path)
 {
     $this->loadContext('ocencryption');
     $this->position = 0;
     $this->cache = '';
     $this->writeFlag = false;
     $this->unencryptedBlockSize = $this->encryptionModule->getUnencryptedBlockSize($this->signed);
     if ($mode === 'w' || $mode === 'w+' || $mode === 'wb' || $mode === 'wb+' || $mode === 'r+' || $mode === 'rb+') {
         $this->readOnly = false;
     } else {
         $this->readOnly = true;
     }
     $sharePath = $this->fullPath;
     if (!$this->storage->file_exists($this->internalPath)) {
         $sharePath = dirname($sharePath);
     }
     $accessList = $this->file->getAccessList($sharePath);
     $this->newHeader = $this->encryptionModule->begin($this->fullPath, $this->uid, $mode, $this->header, $accessList);
     if ($mode === 'w' || $mode === 'w+' || $mode === 'wb' || $mode === 'wb+') {
         // We're writing a new file so start write counter with 0 bytes
         $this->unencryptedSize = 0;
         $this->writeHeader();
         $this->headerSize = $this->util->getHeaderSize();
         $this->size = $this->headerSize;
     } else {
         $this->skipHeader();
     }
     return true;
 }