ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
PPS.php
Go to the documentation of this file.
1 <?php
2 /* vim: set expandtab tabstop=4 shiftwidth=4: */
3 // +----------------------------------------------------------------------+
4 // | PHP Version 4 |
5 // +----------------------------------------------------------------------+
6 // | Copyright (c) 1997-2002 The PHP Group |
7 // +----------------------------------------------------------------------+
8 // | This source file is subject to version 2.02 of the PHP license, |
9 // | that is bundled with this package in the file LICENSE, and is |
10 // | available at through the world-wide-web at |
11 // | http://www.php.net/license/2_02.txt. |
12 // | If you did not receive a copy of the PHP license and are unable to |
13 // | obtain it through the world-wide-web, please send a note to |
14 // | license@php.net so we can mail you a copy immediately. |
15 // +----------------------------------------------------------------------+
16 // | Author: Xavier Noguer <xnoguer@php.net> |
17 // | Based on OLE::Storage_Lite by Kawai, Takanori |
18 // +----------------------------------------------------------------------+
19 //
20 // $Id: PPS.php,v 1.7 2007/02/13 21:00:42 schmidt Exp $
21 
22 
23 require_once 'PEAR.php';
24 require_once 'OLE.php';
25 
33 class OLE_PPS extends PEAR
34 {
39  var $No;
40 
45  var $Name;
46 
51  var $Type;
52 
57  var $PrevPps;
58 
63  var $NextPps;
64 
69  var $DirPps;
70 
75  var $Time1st;
76 
81  var $Time2nd;
82 
88 
93  var $Size;
94 
99  var $_data;
100 
105  var $children = array();
106 
111  var $ole;
112 
128  function OLE_PPS($No, $name, $type, $prev, $next, $dir, $time_1st, $time_2nd, $data, $children)
129  {
130  $this->No = $No;
131  $this->Name = $name;
132  $this->Type = $type;
133  $this->PrevPps = $prev;
134  $this->NextPps = $next;
135  $this->DirPps = $dir;
136  $this->Time1st = $time_1st;
137  $this->Time2nd = $time_2nd;
138  $this->_data = $data;
139  $this->children = $children;
140  if ($data != '') {
141  $this->Size = strlen($data);
142  } else {
143  $this->Size = 0;
144  }
145  }
146 
153  function _DataLen()
154  {
155  if (!isset($this->_data)) {
156  return 0;
157  }
158  if (isset($this->_PPS_FILE)) {
159  fseek($this->_PPS_FILE, 0);
160  $stats = fstat($this->_PPS_FILE);
161  return $stats[7];
162  } else {
163  return strlen($this->_data);
164  }
165  }
166 
173  function _getPpsWk()
174  {
175  $ret = $this->Name;
176  for ($i = 0; $i < (64 - strlen($this->Name)); $i++) {
177  $ret .= "\x00";
178  }
179  $ret .= pack("v", strlen($this->Name) + 2) // 66
180  . pack("c", $this->Type) // 67
181  . pack("c", 0x00) //UK // 68
182  . pack("V", $this->PrevPps) //Prev // 72
183  . pack("V", $this->NextPps) //Next // 76
184  . pack("V", $this->DirPps) //Dir // 80
185  . "\x00\x09\x02\x00" // 84
186  . "\x00\x00\x00\x00" // 88
187  . "\xc0\x00\x00\x00" // 92
188  . "\x00\x00\x00\x46" // 96 // Seems to be ok only for Root
189  . "\x00\x00\x00\x00" // 100
190  . OLE::LocalDate2OLE($this->Time1st) // 108
191  . OLE::LocalDate2OLE($this->Time2nd) // 116
192  . pack("V", isset($this->_StartBlock)?
193  $this->_StartBlock:0) // 120
194  . pack("V", $this->Size) // 124
195  . pack("V", 0); // 128
196  return $ret;
197  }
198 
208  function _savePpsSetPnt(&$pps_array)
209  {
210  $pps_array[count($pps_array)] = &$this;
211  $this->No = count($pps_array) - 1;
212  $this->PrevPps = 0xFFFFFFFF;
213  $this->NextPps = 0xFFFFFFFF;
214  if (count($this->children) > 0) {
215  $this->DirPps = $this->children[0]->_savePpsSetPnt($pps_array);
216  } else {
217  $this->DirPps = 0xFFFFFFFF;
218  }
219  return $this->No;
220  }
221 }
222 ?>