PhpOffice\PhpPresentation\Reader\PowerPoint97::loadCurrentUserStream PHP Method

loadCurrentUserStream() private method

Stream Current User
private loadCurrentUserStream ( )
    private function loadCurrentUserStream()
    {
        $pos = 0;
        /**
         * CurrentUserAtom : http://msdn.microsoft.com/en-us/library/dd948895(v=office.12).aspx
         */
        // RecordHeader : http://msdn.microsoft.com/en-us/library/dd926377(v=office.12).aspx
        $rHeader = $this->loadRecordHeader($this->streamCurrentUser, $pos);
        $pos += 8;
        if ($rHeader['recVer'] != 0x0 || $rHeader['recInstance'] != 0x0 || $rHeader['recType'] != self::RT_CURRENTUSERATOM) {
            throw new \Exception('File PowerPoint 97 in error (Location : CurrentUserAtom > RecordHeader).');
        }
        // Size
        $size = self::getInt4d($this->streamCurrentUser, $pos);
        $pos += 4;
        if ($size != 0x14) {
            throw new \Exception('File PowerPoint 97 in error (Location : CurrentUserAtom > Size).');
        }
        // headerToken
        $headerToken = self::getInt4d($this->streamCurrentUser, $pos);
        $pos += 4;
        if ($headerToken == 0xf3d1c4df && $headerToken != 0xe391c05f) {
            throw new \Exception('Feature not implemented (l.' . __LINE__ . ') : Encrypted file');
        }
        // offsetToCurrentEdit
        $this->offsetToCurrentEdit = self::getInt4d($this->streamCurrentUser, $pos);
        $pos += 4;
        // lenUserName
        $lenUserName = self::getInt2d($this->streamCurrentUser, $pos);
        $pos += 2;
        if ($lenUserName > 255) {
            throw new \Exception('File PowerPoint 97 in error (Location : CurrentUserAtom > lenUserName).');
        }
        // docFileVersion
        $docFileVersion = self::getInt2d($this->streamCurrentUser, $pos);
        $pos += 2;
        if ($docFileVersion != 0x3f4) {
            throw new \Exception('File PowerPoint 97 in error (Location : CurrentUserAtom > docFileVersion).');
        }
        // majorVersion
        $majorVersion = self::getInt1d($this->streamCurrentUser, $pos);
        $pos += 1;
        if ($majorVersion != 0x3) {
            throw new \Exception('File PowerPoint 97 in error (Location : CurrentUserAtom > majorVersion).');
        }
        // minorVersion
        $minorVersion = self::getInt1d($this->streamCurrentUser, $pos);
        $pos += 1;
        if ($minorVersion != 0x0) {
            throw new \Exception('File PowerPoint 97 in error (Location : CurrentUserAtom > minorVersion).');
        }
        // unused
        $pos += 2;
        // ansiUserName
        $ansiUserName = '';
        do {
            $char = self::getInt1d($this->streamCurrentUser, $pos);
            if ($char >= 0x0 && $char <= 0x1f || $char >= 0x7f && $char <= 0x9f) {
                $char = false;
            } else {
                $ansiUserName .= chr($char);
                $pos += 1;
            }
        } while ($char !== false);
        // relVersion
        $relVersion = self::getInt4d($this->streamCurrentUser, $pos);
        $pos += 4;
        if ($relVersion != 0x8 && $relVersion != 0x9) {
            throw new \Exception('File PowerPoint 97 in error (Location : CurrentUserAtom > relVersion).');
        }
        // unicodeUserName
        $unicodeUserName = '';
        for ($inc = 0; $inc < $lenUserName; $inc++) {
            $char = self::getInt2d($this->streamCurrentUser, $pos);
            if ($char >= 0x0 && $char <= 0x1f || $char >= 0x7f && $char <= 0x9f) {
                break;
            }
            $unicodeUserName .= chr($char);
            $pos += 2;
        }
    }
PowerPoint97