123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222 |
- <?php
- require_once 'PEAR.php';
- require_once 'OLE.php';
- class OLE_PPS extends PEAR
- {
-
- var $No;
-
- var $Name;
-
- var $Type;
-
- var $PrevPps;
-
- var $NextPps;
-
- var $DirPps;
-
- var $Time1st;
-
- var $Time2nd;
-
- var $_StartBlock;
-
- var $Size;
-
- var $_data;
-
- var $children = array();
-
- var $ole;
-
- function OLE_PPS($No, $name, $type, $prev, $next, $dir, $time_1st, $time_2nd, $data, $children)
- {
- $this->No = $No;
- $this->Name = $name;
- $this->Type = $type;
- $this->PrevPps = $prev;
- $this->NextPps = $next;
- $this->DirPps = $dir;
- $this->Time1st = $time_1st;
- $this->Time2nd = $time_2nd;
- $this->_data = $data;
- $this->children = $children;
- if ($data != '') {
- $this->Size = strlen($data);
- } else {
- $this->Size = 0;
- }
- }
-
- function _DataLen()
- {
- if (!isset($this->_data)) {
- return 0;
- }
- if (isset($this->_PPS_FILE)) {
- fseek($this->_PPS_FILE, 0);
- $stats = fstat($this->_PPS_FILE);
- return $stats[7];
- } else {
- return strlen($this->_data);
- }
- }
-
- function _getPpsWk()
- {
- $ret = $this->Name;
- for ($i = 0; $i < (64 - strlen($this->Name)); $i++) {
- $ret .= "\x00";
- }
- $ret .= pack("v", strlen($this->Name) + 2)
- . pack("c", $this->Type)
- . pack("c", 0x00)
- . pack("V", $this->PrevPps)
- . pack("V", $this->NextPps)
- . pack("V", $this->DirPps)
- . "\x00\x09\x02\x00"
- . "\x00\x00\x00\x00"
- . "\xc0\x00\x00\x00"
- . "\x00\x00\x00\x46"
- . "\x00\x00\x00\x00"
- . OLE::LocalDate2OLE($this->Time1st)
- . OLE::LocalDate2OLE($this->Time2nd)
- . pack("V", isset($this->_StartBlock)?
- $this->_StartBlock:0)
- . pack("V", $this->Size)
- . pack("V", 0);
- return $ret;
- }
-
- function _savePpsSetPnt(&$pps_array)
- {
- $pps_array[count($pps_array)] = &$this;
- $this->No = count($pps_array) - 1;
- $this->PrevPps = 0xFFFFFFFF;
- $this->NextPps = 0xFFFFFFFF;
- if (count($this->children) > 0) {
- $this->DirPps = $this->children[0]->_savePpsSetPnt($pps_array);
- } else {
- $this->DirPps = 0xFFFFFFFF;
- }
- return $this->No;
- }
- }
- ?>
|