@@ -32,41 +32,41 @@ discard block |
||
32 | 32 | class OLE_PPS_Root extends OLE_PPS |
33 | 33 | { |
34 | 34 | /** |
35 | - * The temporary dir for storing the OLE file |
|
36 | - * @var string |
|
37 | - */ |
|
35 | + * The temporary dir for storing the OLE file |
|
36 | + * @var string |
|
37 | + */ |
|
38 | 38 | var $_tmp_dir; |
39 | 39 | |
40 | 40 | /** |
41 | - * Constructor |
|
42 | - * |
|
43 | - * @access public |
|
44 | - * @param integer $time_1st A timestamp |
|
45 | - * @param integer $time_2nd A timestamp |
|
46 | - */ |
|
41 | + * Constructor |
|
42 | + * |
|
43 | + * @access public |
|
44 | + * @param integer $time_1st A timestamp |
|
45 | + * @param integer $time_2nd A timestamp |
|
46 | + */ |
|
47 | 47 | function OLE_PPS_Root($time_1st, $time_2nd, $raChild) |
48 | 48 | { |
49 | 49 | $this->_tmp_dir = ''; |
50 | 50 | $this->OLE_PPS( |
51 | - null, |
|
52 | - OLE::Asc2Ucs('Root Entry'), |
|
53 | - OLE_PPS_TYPE_ROOT, |
|
54 | - null, |
|
55 | - null, |
|
56 | - null, |
|
57 | - $time_1st, |
|
58 | - $time_2nd, |
|
59 | - null, |
|
60 | - $raChild); |
|
51 | + null, |
|
52 | + OLE::Asc2Ucs('Root Entry'), |
|
53 | + OLE_PPS_TYPE_ROOT, |
|
54 | + null, |
|
55 | + null, |
|
56 | + null, |
|
57 | + $time_1st, |
|
58 | + $time_2nd, |
|
59 | + null, |
|
60 | + $raChild); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | /** |
64 | - * Sets the temp dir used for storing the OLE file |
|
65 | - * |
|
66 | - * @access public |
|
67 | - * @param string $dir The dir to be used as temp dir |
|
68 | - * @return true if given dir is valid, false otherwise |
|
69 | - */ |
|
64 | + * Sets the temp dir used for storing the OLE file |
|
65 | + * |
|
66 | + * @access public |
|
67 | + * @param string $dir The dir to be used as temp dir |
|
68 | + * @return true if given dir is valid, false otherwise |
|
69 | + */ |
|
70 | 70 | function setTempDir($dir) |
71 | 71 | { |
72 | 72 | if (is_dir($dir)) { |
@@ -77,21 +77,21 @@ discard block |
||
77 | 77 | } |
78 | 78 | |
79 | 79 | /** |
80 | - * Method for saving the whole OLE container (including files). |
|
81 | - * In fact, if called with an empty argument (or '-'), it saves to a |
|
82 | - * temporary file and then outputs it's contents to stdout. |
|
83 | - * |
|
84 | - * @param string $filename The name of the file where to save the OLE container |
|
85 | - * @access public |
|
86 | - * @return mixed true on success, PEAR_Error on failure |
|
87 | - */ |
|
80 | + * Method for saving the whole OLE container (including files). |
|
81 | + * In fact, if called with an empty argument (or '-'), it saves to a |
|
82 | + * temporary file and then outputs it's contents to stdout. |
|
83 | + * |
|
84 | + * @param string $filename The name of the file where to save the OLE container |
|
85 | + * @access public |
|
86 | + * @return mixed true on success, PEAR_Error on failure |
|
87 | + */ |
|
88 | 88 | function save($filename) |
89 | 89 | { |
90 | 90 | // Initial Setting for saving |
91 | 91 | $this->_BIG_BLOCK_SIZE = pow(2, |
92 | - ((isset($this->_BIG_BLOCK_SIZE))? $this->_adjust2($this->_BIG_BLOCK_SIZE) : 9)); |
|
92 | + ((isset($this->_BIG_BLOCK_SIZE))? $this->_adjust2($this->_BIG_BLOCK_SIZE) : 9)); |
|
93 | 93 | $this->_SMALL_BLOCK_SIZE= pow(2, |
94 | - ((isset($this->_SMALL_BLOCK_SIZE))? $this->_adjust2($this->_SMALL_BLOCK_SIZE): 6)); |
|
94 | + ((isset($this->_SMALL_BLOCK_SIZE))? $this->_adjust2($this->_SMALL_BLOCK_SIZE): 6)); |
|
95 | 95 | |
96 | 96 | // Open temp file if we are sending output to stdout |
97 | 97 | if (($filename == '-') || ($filename == '')) { |
@@ -138,12 +138,12 @@ discard block |
||
138 | 138 | } |
139 | 139 | |
140 | 140 | /** |
141 | - * Calculate some numbers |
|
142 | - * |
|
143 | - * @access private |
|
144 | - * @param array $raList Reference to an array of PPS's |
|
145 | - * @return array The array of numbers |
|
146 | - */ |
|
141 | + * Calculate some numbers |
|
142 | + * |
|
143 | + * @access private |
|
144 | + * @param array $raList Reference to an array of PPS's |
|
145 | + * @return array The array of numbers |
|
146 | + */ |
|
147 | 147 | function _calcSize(&$raList) |
148 | 148 | { |
149 | 149 | // Calculate Basic Setting |
@@ -175,13 +175,13 @@ discard block |
||
175 | 175 | } |
176 | 176 | |
177 | 177 | /** |
178 | - * Helper function for caculating a magic value for block sizes |
|
179 | - * |
|
180 | - * @access private |
|
181 | - * @param integer $i2 The argument |
|
182 | - * @see save() |
|
183 | - * @return integer |
|
184 | - */ |
|
178 | + * Helper function for caculating a magic value for block sizes |
|
179 | + * |
|
180 | + * @access private |
|
181 | + * @param integer $i2 The argument |
|
182 | + * @see save() |
|
183 | + * @return integer |
|
184 | + */ |
|
185 | 185 | function _adjust2($i2) |
186 | 186 | { |
187 | 187 | $iWk = log($i2)/log(2); |
@@ -189,13 +189,13 @@ discard block |
||
189 | 189 | } |
190 | 190 | |
191 | 191 | /** |
192 | - * Save OLE header |
|
193 | - * |
|
194 | - * @access private |
|
195 | - * @param integer $iSBDcnt |
|
196 | - * @param integer $iBBcnt |
|
197 | - * @param integer $iPPScnt |
|
198 | - */ |
|
192 | + * Save OLE header |
|
193 | + * |
|
194 | + * @access private |
|
195 | + * @param integer $iSBDcnt |
|
196 | + * @param integer $iBBcnt |
|
197 | + * @param integer $iPPScnt |
|
198 | + */ |
|
199 | 199 | function _saveHeader($iSBDcnt, $iBBcnt, $iPPScnt) |
200 | 200 | { |
201 | 201 | $FILE = $this->_FILEH_; |
@@ -225,32 +225,32 @@ discard block |
||
225 | 225 | |
226 | 226 | // Save Header |
227 | 227 | fwrite($FILE, |
228 | - "\xD0\xCF\x11\xE0\xA1\xB1\x1A\xE1" |
|
229 | - . "\x00\x00\x00\x00" |
|
230 | - . "\x00\x00\x00\x00" |
|
231 | - . "\x00\x00\x00\x00" |
|
232 | - . "\x00\x00\x00\x00" |
|
233 | - . pack("v", 0x3b) |
|
234 | - . pack("v", 0x03) |
|
235 | - . pack("v", -2) |
|
236 | - . pack("v", 9) |
|
237 | - . pack("v", 6) |
|
238 | - . pack("v", 0) |
|
239 | - . "\x00\x00\x00\x00" |
|
240 | - . "\x00\x00\x00\x00" |
|
241 | - . pack("V", $iBdCnt) |
|
242 | - . pack("V", $iBBcnt+$iSBDcnt) //ROOT START |
|
243 | - . pack("V", 0) |
|
244 | - . pack("V", 0x1000) |
|
245 | - . pack("V", 0) //Small Block Depot |
|
246 | - . pack("V", 1) |
|
247 | - ); |
|
228 | + "\xD0\xCF\x11\xE0\xA1\xB1\x1A\xE1" |
|
229 | + . "\x00\x00\x00\x00" |
|
230 | + . "\x00\x00\x00\x00" |
|
231 | + . "\x00\x00\x00\x00" |
|
232 | + . "\x00\x00\x00\x00" |
|
233 | + . pack("v", 0x3b) |
|
234 | + . pack("v", 0x03) |
|
235 | + . pack("v", -2) |
|
236 | + . pack("v", 9) |
|
237 | + . pack("v", 6) |
|
238 | + . pack("v", 0) |
|
239 | + . "\x00\x00\x00\x00" |
|
240 | + . "\x00\x00\x00\x00" |
|
241 | + . pack("V", $iBdCnt) |
|
242 | + . pack("V", $iBBcnt+$iSBDcnt) //ROOT START |
|
243 | + . pack("V", 0) |
|
244 | + . pack("V", 0x1000) |
|
245 | + . pack("V", 0) //Small Block Depot |
|
246 | + . pack("V", 1) |
|
247 | + ); |
|
248 | 248 | // Extra BDList Start, Count |
249 | 249 | if ($iBdCnt < $i1stBdL) { |
250 | 250 | fwrite($FILE, |
251 | - pack("V", -2). // Extra BDList Start |
|
252 | - pack("V", 0) // Extra BDList Count |
|
253 | - ); |
|
251 | + pack("V", -2). // Extra BDList Start |
|
252 | + pack("V", 0) // Extra BDList Count |
|
253 | + ); |
|
254 | 254 | } else { |
255 | 255 | fwrite($FILE, pack("V", $iAll+$iBdCnt) . pack("V", $iBdExL)); |
256 | 256 | } |
@@ -267,12 +267,12 @@ discard block |
||
267 | 267 | } |
268 | 268 | |
269 | 269 | /** |
270 | - * Saving big data (PPS's with data bigger than OLE_DATA_SIZE_SMALL) |
|
271 | - * |
|
272 | - * @access private |
|
273 | - * @param integer $iStBlk |
|
274 | - * @param array &$raList Reference to array of PPS's |
|
275 | - */ |
|
270 | + * Saving big data (PPS's with data bigger than OLE_DATA_SIZE_SMALL) |
|
271 | + * |
|
272 | + * @access private |
|
273 | + * @param integer $iStBlk |
|
274 | + * @param array &$raList Reference to array of PPS's |
|
275 | + */ |
|
276 | 276 | function _saveBigData($iStBlk, &$raList) |
277 | 277 | { |
278 | 278 | $FILE = $this->_FILEH_; |
@@ -318,11 +318,11 @@ discard block |
||
318 | 318 | } |
319 | 319 | |
320 | 320 | /** |
321 | - * get small data (PPS's with data smaller than OLE_DATA_SIZE_SMALL) |
|
322 | - * |
|
323 | - * @access private |
|
324 | - * @param array &$raList Reference to array of PPS's |
|
325 | - */ |
|
321 | + * get small data (PPS's with data smaller than OLE_DATA_SIZE_SMALL) |
|
322 | + * |
|
323 | + * @access private |
|
324 | + * @param array &$raList Reference to array of PPS's |
|
325 | + */ |
|
326 | 326 | function _makeSmallData(&$raList) |
327 | 327 | { |
328 | 328 | $sRes = ''; |
@@ -374,11 +374,11 @@ discard block |
||
374 | 374 | } |
375 | 375 | |
376 | 376 | /** |
377 | - * Saves all the PPS's WKs |
|
378 | - * |
|
379 | - * @access private |
|
380 | - * @param array $raList Reference to an array with all PPS's |
|
381 | - */ |
|
377 | + * Saves all the PPS's WKs |
|
378 | + * |
|
379 | + * @access private |
|
380 | + * @param array $raList Reference to an array with all PPS's |
|
381 | + */ |
|
382 | 382 | function _savePps(&$raList) |
383 | 383 | { |
384 | 384 | // Save each PPS WK |
@@ -396,13 +396,13 @@ discard block |
||
396 | 396 | } |
397 | 397 | |
398 | 398 | /** |
399 | - * Saving Big Block Depot |
|
400 | - * |
|
401 | - * @access private |
|
402 | - * @param integer $iSbdSize |
|
403 | - * @param integer $iBsize |
|
404 | - * @param integer $iPpsCnt |
|
405 | - */ |
|
399 | + * Saving Big Block Depot |
|
400 | + * |
|
401 | + * @access private |
|
402 | + * @param integer $iSbdSize |
|
403 | + * @param integer $iBsize |
|
404 | + * @param integer $iPpsCnt |
|
405 | + */ |
|
406 | 406 | function _saveBbd($iSbdSize, $iBsize, $iPpsCnt) |
407 | 407 | { |
408 | 408 | $FILE = $this->_FILEH_; |
@@ -30,18 +30,18 @@ discard block |
||
30 | 30 | class OLE_PPS_File extends OLE_PPS |
31 | 31 | { |
32 | 32 | /** |
33 | - * The temporary dir for storing the OLE file |
|
34 | - * @var string |
|
35 | - */ |
|
33 | + * The temporary dir for storing the OLE file |
|
34 | + * @var string |
|
35 | + */ |
|
36 | 36 | var $_tmp_dir; |
37 | 37 | |
38 | 38 | /** |
39 | - * The constructor |
|
40 | - * |
|
41 | - * @access public |
|
42 | - * @param string $name The name of the file (in Unicode) |
|
43 | - * @see OLE::Asc2Ucs() |
|
44 | - */ |
|
39 | + * The constructor |
|
40 | + * |
|
41 | + * @access public |
|
42 | + * @param string $name The name of the file (in Unicode) |
|
43 | + * @see OLE::Asc2Ucs() |
|
44 | + */ |
|
45 | 45 | function OLE_PPS_File($name) |
46 | 46 | { |
47 | 47 | $this->_tmp_dir = ''; |
@@ -59,12 +59,12 @@ discard block |
||
59 | 59 | } |
60 | 60 | |
61 | 61 | /** |
62 | - * Sets the temp dir used for storing the OLE file |
|
63 | - * |
|
64 | - * @access public |
|
65 | - * @param string $dir The dir to be used as temp dir |
|
66 | - * @return true if given dir is valid, false otherwise |
|
67 | - */ |
|
62 | + * Sets the temp dir used for storing the OLE file |
|
63 | + * |
|
64 | + * @access public |
|
65 | + * @param string $dir The dir to be used as temp dir |
|
66 | + * @return true if given dir is valid, false otherwise |
|
67 | + */ |
|
68 | 68 | function setTempDir($dir) |
69 | 69 | { |
70 | 70 | if (is_dir($dir)) { |
@@ -75,11 +75,11 @@ discard block |
||
75 | 75 | } |
76 | 76 | |
77 | 77 | /** |
78 | - * Initialization method. Has to be called right after OLE_PPS_File(). |
|
79 | - * |
|
80 | - * @access public |
|
81 | - * @return mixed true on success. PEAR_Error on failure |
|
82 | - */ |
|
78 | + * Initialization method. Has to be called right after OLE_PPS_File(). |
|
79 | + * |
|
80 | + * @access public |
|
81 | + * @return mixed true on success. PEAR_Error on failure |
|
82 | + */ |
|
83 | 83 | function init() |
84 | 84 | { |
85 | 85 | $this->_tmp_filename = tempnam($this->_tmp_dir, "OLE_PPS_File"); |
@@ -96,11 +96,11 @@ discard block |
||
96 | 96 | } |
97 | 97 | |
98 | 98 | /** |
99 | - * Append data to PPS |
|
100 | - * |
|
101 | - * @access public |
|
102 | - * @param string $data The data to append |
|
103 | - */ |
|
99 | + * Append data to PPS |
|
100 | + * |
|
101 | + * @access public |
|
102 | + * @param string $data The data to append |
|
103 | + */ |
|
104 | 104 | function append($data) |
105 | 105 | { |
106 | 106 | if ($this->_PPS_FILE) { |
@@ -49,74 +49,74 @@ discard block |
||
49 | 49 | { |
50 | 50 | |
51 | 51 | /** |
52 | - * The file handle for reading an OLE container |
|
53 | - * @var resource |
|
54 | - */ |
|
52 | + * The file handle for reading an OLE container |
|
53 | + * @var resource |
|
54 | + */ |
|
55 | 55 | var $_file_handle; |
56 | 56 | |
57 | 57 | /** |
58 | - * Array of PPS's found on the OLE container |
|
59 | - * @var array |
|
60 | - */ |
|
58 | + * Array of PPS's found on the OLE container |
|
59 | + * @var array |
|
60 | + */ |
|
61 | 61 | var $_list; |
62 | 62 | |
63 | 63 | /** |
64 | - * Root directory of OLE container |
|
65 | - * @var OLE_PPS_Root |
|
66 | - */ |
|
64 | + * Root directory of OLE container |
|
65 | + * @var OLE_PPS_Root |
|
66 | + */ |
|
67 | 67 | var $root; |
68 | 68 | |
69 | 69 | /** |
70 | - * Big Block Allocation Table |
|
71 | - * @var array (blockId => nextBlockId) |
|
72 | - */ |
|
70 | + * Big Block Allocation Table |
|
71 | + * @var array (blockId => nextBlockId) |
|
72 | + */ |
|
73 | 73 | var $bbat; |
74 | 74 | |
75 | 75 | /** |
76 | - * Short Block Allocation Table |
|
77 | - * @var array (blockId => nextBlockId) |
|
78 | - */ |
|
76 | + * Short Block Allocation Table |
|
77 | + * @var array (blockId => nextBlockId) |
|
78 | + */ |
|
79 | 79 | var $sbat; |
80 | 80 | |
81 | 81 | /** |
82 | - * Size of big blocks. This is usually 512. |
|
83 | - * @var int number of octets per block. |
|
84 | - */ |
|
82 | + * Size of big blocks. This is usually 512. |
|
83 | + * @var int number of octets per block. |
|
84 | + */ |
|
85 | 85 | var $bigBlockSize; |
86 | 86 | |
87 | 87 | /** |
88 | - * Size of small blocks. This is usually 64. |
|
89 | - * @var int number of octets per block |
|
90 | - */ |
|
88 | + * Size of small blocks. This is usually 64. |
|
89 | + * @var int number of octets per block |
|
90 | + */ |
|
91 | 91 | var $smallBlockSize; |
92 | 92 | |
93 | 93 | /** |
94 | - * Creates a new OLE object |
|
95 | - * @access public |
|
96 | - */ |
|
94 | + * Creates a new OLE object |
|
95 | + * @access public |
|
96 | + */ |
|
97 | 97 | function OLE() |
98 | 98 | { |
99 | 99 | $this->_list = array(); |
100 | 100 | } |
101 | 101 | |
102 | 102 | /** |
103 | - * Destructor (using PEAR) |
|
104 | - * Just closes the file handle on the OLE file. |
|
105 | - * |
|
106 | - * @access private |
|
107 | - */ |
|
103 | + * Destructor (using PEAR) |
|
104 | + * Just closes the file handle on the OLE file. |
|
105 | + * |
|
106 | + * @access private |
|
107 | + */ |
|
108 | 108 | function _OLE() |
109 | 109 | { |
110 | 110 | fclose($this->_file_handle); |
111 | 111 | } |
112 | 112 | |
113 | 113 | /** |
114 | - * Reads an OLE container from the contents of the file given. |
|
115 | - * |
|
116 | - * @access public |
|
117 | - * @param string $file |
|
118 | - * @return mixed true on success, PEAR_Error on failure |
|
119 | - */ |
|
114 | + * Reads an OLE container from the contents of the file given. |
|
115 | + * |
|
116 | + * @access public |
|
117 | + * @param string $file |
|
118 | + * @return mixed true on success, PEAR_Error on failure |
|
119 | + */ |
|
120 | 120 | function read($file) |
121 | 121 | { |
122 | 122 | $fh = @fopen($file, "r"); |
@@ -281,13 +281,13 @@ discard block |
||
281 | 281 | } |
282 | 282 | |
283 | 283 | /** |
284 | - * Gets information about all PPS's on the OLE container from the PPS WK's |
|
285 | - * creates an OLE_PPS object for each one. |
|
286 | - * |
|
287 | - * @access private |
|
288 | - * @param integer $blockId the block id of the first block |
|
289 | - * @return mixed true on success, PEAR_Error on failure |
|
290 | - */ |
|
284 | + * Gets information about all PPS's on the OLE container from the PPS WK's |
|
285 | + * creates an OLE_PPS object for each one. |
|
286 | + * |
|
287 | + * @access private |
|
288 | + * @param integer $blockId the block id of the first block |
|
289 | + * @return mixed true on success, PEAR_Error on failure |
|
290 | + */ |
|
291 | 291 | function _readPpsWks($blockId) |
292 | 292 | { |
293 | 293 | $fh = $this->getStream($blockId); |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | break; |
308 | 308 | case OLE_PPS_TYPE_DIR: |
309 | 309 | $pps = new OLE_PPS(null, null, null, null, null, |
310 | - null, null, null, null, array()); |
|
310 | + null, null, null, null, array()); |
|
311 | 311 | break; |
312 | 312 | case OLE_PPS_TYPE_FILE: |
313 | 313 | require_once 'OLE/PPS/File.php'; |
@@ -360,13 +360,13 @@ discard block |
||
360 | 360 | } |
361 | 361 | |
362 | 362 | /** |
363 | - * It checks whether the PPS tree is complete (all PPS's read) |
|
364 | - * starting with the given PPS (not necessarily root) |
|
365 | - * |
|
366 | - * @access private |
|
367 | - * @param integer $index The index of the PPS from which we are checking |
|
368 | - * @return boolean Whether the PPS tree for the given PPS is complete |
|
369 | - */ |
|
363 | + * It checks whether the PPS tree is complete (all PPS's read) |
|
364 | + * starting with the given PPS (not necessarily root) |
|
365 | + * |
|
366 | + * @access private |
|
367 | + * @param integer $index The index of the PPS from which we are checking |
|
368 | + * @return boolean Whether the PPS tree for the given PPS is complete |
|
369 | + */ |
|
370 | 370 | function _ppsTreeComplete($index) |
371 | 371 | { |
372 | 372 | return isset($this->_list[$index]) && |
@@ -380,12 +380,12 @@ discard block |
||
380 | 380 | } |
381 | 381 | |
382 | 382 | /** |
383 | - * Checks whether a PPS is a File PPS or not. |
|
384 | - * If there is no PPS for the index given, it will return false. |
|
385 | - * @param integer $index The index for the PPS |
|
386 | - * @return bool true if it's a File PPS, false otherwise |
|
387 | - * @access public |
|
388 | - */ |
|
383 | + * Checks whether a PPS is a File PPS or not. |
|
384 | + * If there is no PPS for the index given, it will return false. |
|
385 | + * @param integer $index The index for the PPS |
|
386 | + * @return bool true if it's a File PPS, false otherwise |
|
387 | + * @access public |
|
388 | + */ |
|
389 | 389 | function isFile($index) |
390 | 390 | { |
391 | 391 | if (isset($this->_list[$index])) { |
@@ -395,12 +395,12 @@ discard block |
||
395 | 395 | } |
396 | 396 | |
397 | 397 | /** |
398 | - * Checks whether a PPS is a Root PPS or not. |
|
399 | - * If there is no PPS for the index given, it will return false. |
|
400 | - * @param integer $index The index for the PPS. |
|
401 | - * @return bool true if it's a Root PPS, false otherwise |
|
402 | - * @access public |
|
403 | - */ |
|
398 | + * Checks whether a PPS is a Root PPS or not. |
|
399 | + * If there is no PPS for the index given, it will return false. |
|
400 | + * @param integer $index The index for the PPS. |
|
401 | + * @return bool true if it's a Root PPS, false otherwise |
|
402 | + * @access public |
|
403 | + */ |
|
404 | 404 | function isRoot($index) |
405 | 405 | { |
406 | 406 | if (isset($this->_list[$index])) { |
@@ -410,26 +410,26 @@ discard block |
||
410 | 410 | } |
411 | 411 | |
412 | 412 | /** |
413 | - * Gives the total number of PPS's found in the OLE container. |
|
414 | - * @return integer The total number of PPS's found in the OLE container |
|
415 | - * @access public |
|
416 | - */ |
|
413 | + * Gives the total number of PPS's found in the OLE container. |
|
414 | + * @return integer The total number of PPS's found in the OLE container |
|
415 | + * @access public |
|
416 | + */ |
|
417 | 417 | function ppsTotal() |
418 | 418 | { |
419 | 419 | return count($this->_list); |
420 | 420 | } |
421 | 421 | |
422 | 422 | /** |
423 | - * Gets data from a PPS |
|
424 | - * If there is no PPS for the index given, it will return an empty string. |
|
425 | - * @param integer $index The index for the PPS |
|
426 | - * @param integer $position The position from which to start reading |
|
427 | - * (relative to the PPS) |
|
428 | - * @param integer $length The amount of bytes to read (at most) |
|
429 | - * @return string The binary string containing the data requested |
|
430 | - * @access public |
|
431 | - * @see OLE_PPS_File::getStream() |
|
432 | - */ |
|
423 | + * Gets data from a PPS |
|
424 | + * If there is no PPS for the index given, it will return an empty string. |
|
425 | + * @param integer $index The index for the PPS |
|
426 | + * @param integer $position The position from which to start reading |
|
427 | + * (relative to the PPS) |
|
428 | + * @param integer $length The amount of bytes to read (at most) |
|
429 | + * @return string The binary string containing the data requested |
|
430 | + * @access public |
|
431 | + * @see OLE_PPS_File::getStream() |
|
432 | + */ |
|
433 | 433 | function getData($index, $position, $length) |
434 | 434 | { |
435 | 435 | // if position is not valid return empty string |
@@ -446,12 +446,12 @@ discard block |
||
446 | 446 | } |
447 | 447 | |
448 | 448 | /** |
449 | - * Gets the data length from a PPS |
|
450 | - * If there is no PPS for the index given, it will return 0. |
|
451 | - * @param integer $index The index for the PPS |
|
452 | - * @return integer The amount of bytes in data the PPS has |
|
453 | - * @access public |
|
454 | - */ |
|
449 | + * Gets the data length from a PPS |
|
450 | + * If there is no PPS for the index given, it will return 0. |
|
451 | + * @param integer $index The index for the PPS |
|
452 | + * @return integer The amount of bytes in data the PPS has |
|
453 | + * @access public |
|
454 | + */ |
|
455 | 455 | function getDataLength($index) |
456 | 456 | { |
457 | 457 | if (isset($this->_list[$index])) { |
@@ -461,13 +461,13 @@ discard block |
||
461 | 461 | } |
462 | 462 | |
463 | 463 | /** |
464 | - * Utility function to transform ASCII text to Unicode |
|
465 | - * |
|
466 | - * @access public |
|
467 | - * @static |
|
468 | - * @param string $ascii The ASCII string to transform |
|
469 | - * @return string The string in Unicode |
|
470 | - */ |
|
464 | + * Utility function to transform ASCII text to Unicode |
|
465 | + * |
|
466 | + * @access public |
|
467 | + * @static |
|
468 | + * @param string $ascii The ASCII string to transform |
|
469 | + * @return string The string in Unicode |
|
470 | + */ |
|
471 | 471 | function Asc2Ucs($ascii) |
472 | 472 | { |
473 | 473 | $rawname = ''; |
@@ -478,14 +478,14 @@ discard block |
||
478 | 478 | } |
479 | 479 | |
480 | 480 | /** |
481 | - * Utility function |
|
482 | - * Returns a string for the OLE container with the date given |
|
483 | - * |
|
484 | - * @access public |
|
485 | - * @static |
|
486 | - * @param integer $date A timestamp |
|
487 | - * @return string The string for the OLE container |
|
488 | - */ |
|
481 | + * Utility function |
|
482 | + * Returns a string for the OLE container with the date given |
|
483 | + * |
|
484 | + * @access public |
|
485 | + * @static |
|
486 | + * @param integer $date A timestamp |
|
487 | + * @return string The string for the OLE container |
|
488 | + */ |
|
489 | 489 | function LocalDate2OLE($date = null) |
490 | 490 | { |
491 | 491 | if (!isset($date)) { |
@@ -500,7 +500,7 @@ discard block |
||
500 | 500 | // calculate seconds |
501 | 501 | $big_date = $days * 24 * 3600 + |
502 | 502 | gmmktime(date("H",$date),date("i",$date),date("s",$date), |
503 | - date("m",$date),date("d",$date),date("Y",$date)); |
|
503 | + date("m",$date),date("d",$date),date("Y",$date)); |
|
504 | 504 | // multiply just to make MS happy |
505 | 505 | $big_date *= 10000000; |
506 | 506 | |
@@ -525,12 +525,12 @@ discard block |
||
525 | 525 | } |
526 | 526 | |
527 | 527 | /** |
528 | - * Returns a timestamp from an OLE container's date |
|
529 | - * @param integer $string A binary string with the encoded date |
|
530 | - * @return string The timestamp corresponding to the string |
|
531 | - * @access public |
|
532 | - * @static |
|
533 | - */ |
|
528 | + * Returns a timestamp from an OLE container's date |
|
529 | + * @param integer $string A binary string with the encoded date |
|
530 | + * @return string The timestamp corresponding to the string |
|
531 | + * @access public |
|
532 | + * @static |
|
533 | + */ |
|
534 | 534 | function OLE2LocalDate($string) |
535 | 535 | { |
536 | 536 | if (strlen($string) != 8) { |
@@ -83,8 +83,8 @@ discard block |
||
83 | 83 | // 25 is length of "ole-chainedblockstream://" |
84 | 84 | parse_str(substr($path, 25), $this->params); |
85 | 85 | if (!isset($this->params['oleInstanceId'], |
86 | - $this->params['blockId'], |
|
87 | - $GLOBALS['_OLE_INSTANCES'][$this->params['oleInstanceId']])) { |
|
86 | + $this->params['blockId'], |
|
87 | + $GLOBALS['_OLE_INSTANCES'][$this->params['oleInstanceId']])) { |
|
88 | 88 | |
89 | 89 | if ($options & STREAM_REPORT_ERRORS) { |
90 | 90 | trigger_error('OLE stream not found', E_USER_WARNING); |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | if (version_compare(PHP_VERSION, '5.0', '>=') && |
164 | 164 | version_compare(PHP_VERSION, '5.1', '<')) { |
165 | 165 | |
166 | - $eof = !$eof; |
|
166 | + $eof = !$eof; |
|
167 | 167 | } |
168 | 168 | return $eof; |
169 | 169 | } |
@@ -33,98 +33,98 @@ discard block |
||
33 | 33 | class OLE_PPS extends PEAR |
34 | 34 | { |
35 | 35 | /** |
36 | - * The PPS index |
|
37 | - * @var integer |
|
38 | - */ |
|
36 | + * The PPS index |
|
37 | + * @var integer |
|
38 | + */ |
|
39 | 39 | var $No; |
40 | 40 | |
41 | 41 | /** |
42 | - * The PPS name (in Unicode) |
|
43 | - * @var string |
|
44 | - */ |
|
42 | + * The PPS name (in Unicode) |
|
43 | + * @var string |
|
44 | + */ |
|
45 | 45 | var $Name; |
46 | 46 | |
47 | 47 | /** |
48 | - * The PPS type. Dir, Root or File |
|
49 | - * @var integer |
|
50 | - */ |
|
48 | + * The PPS type. Dir, Root or File |
|
49 | + * @var integer |
|
50 | + */ |
|
51 | 51 | var $Type; |
52 | 52 | |
53 | 53 | /** |
54 | - * The index of the previous PPS |
|
55 | - * @var integer |
|
56 | - */ |
|
54 | + * The index of the previous PPS |
|
55 | + * @var integer |
|
56 | + */ |
|
57 | 57 | var $PrevPps; |
58 | 58 | |
59 | 59 | /** |
60 | - * The index of the next PPS |
|
61 | - * @var integer |
|
62 | - */ |
|
60 | + * The index of the next PPS |
|
61 | + * @var integer |
|
62 | + */ |
|
63 | 63 | var $NextPps; |
64 | 64 | |
65 | 65 | /** |
66 | - * The index of it's first child if this is a Dir or Root PPS |
|
67 | - * @var integer |
|
68 | - */ |
|
66 | + * The index of it's first child if this is a Dir or Root PPS |
|
67 | + * @var integer |
|
68 | + */ |
|
69 | 69 | var $DirPps; |
70 | 70 | |
71 | 71 | /** |
72 | - * A timestamp |
|
73 | - * @var integer |
|
74 | - */ |
|
72 | + * A timestamp |
|
73 | + * @var integer |
|
74 | + */ |
|
75 | 75 | var $Time1st; |
76 | 76 | |
77 | 77 | /** |
78 | - * A timestamp |
|
79 | - * @var integer |
|
80 | - */ |
|
78 | + * A timestamp |
|
79 | + * @var integer |
|
80 | + */ |
|
81 | 81 | var $Time2nd; |
82 | 82 | |
83 | 83 | /** |
84 | - * Starting block (small or big) for this PPS's data inside the container |
|
85 | - * @var integer |
|
86 | - */ |
|
84 | + * Starting block (small or big) for this PPS's data inside the container |
|
85 | + * @var integer |
|
86 | + */ |
|
87 | 87 | var $_StartBlock; |
88 | 88 | |
89 | 89 | /** |
90 | - * The size of the PPS's data (in bytes) |
|
91 | - * @var integer |
|
92 | - */ |
|
90 | + * The size of the PPS's data (in bytes) |
|
91 | + * @var integer |
|
92 | + */ |
|
93 | 93 | var $Size; |
94 | 94 | |
95 | 95 | /** |
96 | - * The PPS's data (only used if it's not using a temporary file) |
|
97 | - * @var string |
|
98 | - */ |
|
96 | + * The PPS's data (only used if it's not using a temporary file) |
|
97 | + * @var string |
|
98 | + */ |
|
99 | 99 | var $_data; |
100 | 100 | |
101 | 101 | /** |
102 | - * Array of child PPS's (only used by Root and Dir PPS's) |
|
103 | - * @var array |
|
104 | - */ |
|
102 | + * Array of child PPS's (only used by Root and Dir PPS's) |
|
103 | + * @var array |
|
104 | + */ |
|
105 | 105 | var $children = array(); |
106 | 106 | |
107 | 107 | /** |
108 | - * Pointer to OLE container |
|
109 | - * @var OLE |
|
110 | - */ |
|
108 | + * Pointer to OLE container |
|
109 | + * @var OLE |
|
110 | + */ |
|
111 | 111 | var $ole; |
112 | 112 | |
113 | 113 | /** |
114 | - * The constructor |
|
115 | - * |
|
116 | - * @access public |
|
117 | - * @param integer $No The PPS index |
|
118 | - * @param string $name The PPS name |
|
119 | - * @param integer $type The PPS type. Dir, Root or File |
|
120 | - * @param integer $prev The index of the previous PPS |
|
121 | - * @param integer $next The index of the next PPS |
|
122 | - * @param integer $dir The index of it's first child if this is a Dir or Root PPS |
|
123 | - * @param integer $time_1st A timestamp |
|
124 | - * @param integer $time_2nd A timestamp |
|
125 | - * @param string $data The (usually binary) source data of the PPS |
|
126 | - * @param array $children Array containing children PPS for this PPS |
|
127 | - */ |
|
114 | + * The constructor |
|
115 | + * |
|
116 | + * @access public |
|
117 | + * @param integer $No The PPS index |
|
118 | + * @param string $name The PPS name |
|
119 | + * @param integer $type The PPS type. Dir, Root or File |
|
120 | + * @param integer $prev The index of the previous PPS |
|
121 | + * @param integer $next The index of the next PPS |
|
122 | + * @param integer $dir The index of it's first child if this is a Dir or Root PPS |
|
123 | + * @param integer $time_1st A timestamp |
|
124 | + * @param integer $time_2nd A timestamp |
|
125 | + * @param string $data The (usually binary) source data of the PPS |
|
126 | + * @param array $children Array containing children PPS for this PPS |
|
127 | + */ |
|
128 | 128 | function OLE_PPS($No, $name, $type, $prev, $next, $dir, $time_1st, $time_2nd, $data, $children) |
129 | 129 | { |
130 | 130 | $this->No = $No; |
@@ -145,11 +145,11 @@ discard block |
||
145 | 145 | } |
146 | 146 | |
147 | 147 | /** |
148 | - * Returns the amount of data saved for this PPS |
|
149 | - * |
|
150 | - * @access private |
|
151 | - * @return integer The amount of data (in bytes) |
|
152 | - */ |
|
148 | + * Returns the amount of data saved for this PPS |
|
149 | + * |
|
150 | + * @access private |
|
151 | + * @return integer The amount of data (in bytes) |
|
152 | + */ |
|
153 | 153 | function _DataLen() |
154 | 154 | { |
155 | 155 | if (!isset($this->_data)) { |
@@ -165,11 +165,11 @@ discard block |
||
165 | 165 | } |
166 | 166 | |
167 | 167 | /** |
168 | - * Returns a string with the PPS's WK (What is a WK?) |
|
169 | - * |
|
170 | - * @access private |
|
171 | - * @return string The binary string |
|
172 | - */ |
|
168 | + * Returns a string with the PPS's WK (What is a WK?) |
|
169 | + * |
|
170 | + * @access private |
|
171 | + * @return string The binary string |
|
172 | + */ |
|
173 | 173 | function _getPpsWk() |
174 | 174 | { |
175 | 175 | $ret = $this->Name; |
@@ -177,34 +177,34 @@ discard block |
||
177 | 177 | $ret .= "\x00"; |
178 | 178 | } |
179 | 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)? |
|
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 | 193 | $this->_StartBlock:0) // 120 |
194 | - . pack("V", $this->Size) // 124 |
|
195 | - . pack("V", 0); // 128 |
|
194 | + . pack("V", $this->Size) // 124 |
|
195 | + . pack("V", 0); // 128 |
|
196 | 196 | return $ret; |
197 | 197 | } |
198 | 198 | |
199 | 199 | /** |
200 | - * Updates index and pointers to previous, next and children PPS's for this |
|
201 | - * PPS. I don't think it'll work with Dir PPS's. |
|
202 | - * |
|
203 | - * @access private |
|
204 | - * @param array &$pps_array Reference to the array of PPS's for the whole OLE |
|
205 | - * container |
|
206 | - * @return integer The index for this PPS |
|
207 | - */ |
|
200 | + * Updates index and pointers to previous, next and children PPS's for this |
|
201 | + * PPS. I don't think it'll work with Dir PPS's. |
|
202 | + * |
|
203 | + * @access private |
|
204 | + * @param array &$pps_array Reference to the array of PPS's for the whole OLE |
|
205 | + * container |
|
206 | + * @return integer The index for this PPS |
|
207 | + */ |
|
208 | 208 | function _savePpsSetPnt(&$pps_array) |
209 | 209 | { |
210 | 210 | $pps_array[count($pps_array)] = &$this; |
@@ -441,17 +441,17 @@ discard block |
||
441 | 441 | * List of vowels and vowel sounds |
442 | 442 | */ |
443 | 443 | $v = array('a', 'e', 'i', 'o', 'u', 'ae', 'ou', 'io', |
444 | - 'ea', 'ou', 'ia', 'ai' |
|
445 | - ); |
|
444 | + 'ea', 'ou', 'ia', 'ai' |
|
445 | + ); |
|
446 | 446 | |
447 | 447 | /** |
448 | 448 | * List of consonants and consonant sounds |
449 | 449 | */ |
450 | 450 | $c = array('b', 'c', 'd', 'g', 'h', 'j', 'k', 'l', 'm', |
451 | - 'n', 'p', 'r', 's', 't', 'u', 'v', 'w', |
|
452 | - 'tr', 'cr', 'fr', 'dr', 'wr', 'pr', 'th', |
|
453 | - 'ch', 'ph', 'st', 'sl', 'cl' |
|
454 | - ); |
|
451 | + 'n', 'p', 'r', 's', 't', 'u', 'v', 'w', |
|
452 | + 'tr', 'cr', 'fr', 'dr', 'wr', 'pr', 'th', |
|
453 | + 'ch', 'ph', 'st', 'sl', 'cl' |
|
454 | + ); |
|
455 | 455 | |
456 | 456 | $v_count = 12; |
457 | 457 | $c_count = 29; |
@@ -484,50 +484,50 @@ discard block |
||
484 | 484 | /** |
485 | 485 | * List of character which could be use in the password |
486 | 486 | */ |
487 | - switch($chars) { |
|
487 | + switch($chars) { |
|
488 | 488 | |
489 | - case 'alphanumeric': |
|
489 | + case 'alphanumeric': |
|
490 | 490 | $chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; |
491 | - $GLOBALS['_Text_Password_NumberOfPossibleCharacters'] = 62; |
|
492 | - break; |
|
491 | + $GLOBALS['_Text_Password_NumberOfPossibleCharacters'] = 62; |
|
492 | + break; |
|
493 | 493 | |
494 | - case 'alphabetical': |
|
494 | + case 'alphabetical': |
|
495 | 495 | $chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'; |
496 | - $GLOBALS['_Text_Password_NumberOfPossibleCharacters'] = 52; |
|
497 | - break; |
|
496 | + $GLOBALS['_Text_Password_NumberOfPossibleCharacters'] = 52; |
|
497 | + break; |
|
498 | 498 | |
499 | - case 'numeric': |
|
499 | + case 'numeric': |
|
500 | 500 | $chars = '0123456789'; |
501 | - $GLOBALS['_Text_Password_NumberOfPossibleCharacters'] = 10; |
|
502 | - break; |
|
501 | + $GLOBALS['_Text_Password_NumberOfPossibleCharacters'] = 10; |
|
502 | + break; |
|
503 | 503 | |
504 | - case '': |
|
504 | + case '': |
|
505 | 505 | $chars = '_#@%&ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; |
506 | - $GLOBALS['_Text_Password_NumberOfPossibleCharacters'] = 67; |
|
507 | - break; |
|
506 | + $GLOBALS['_Text_Password_NumberOfPossibleCharacters'] = 67; |
|
507 | + break; |
|
508 | 508 | |
509 | - default: |
|
509 | + default: |
|
510 | 510 | /** |
511 | 511 | * Some characters shouldn't be used |
512 | 512 | */ |
513 | 513 | $chars = trim($chars); |
514 | - $chars = str_replace(array('+', '|', '$', '^', '/', '\\', ','), '', $chars); |
|
515 | - |
|
516 | - $GLOBALS['_Text_Password_NumberOfPossibleCharacters'] = strlen($chars); |
|
517 | - } |
|
518 | - |
|
519 | - /** |
|
520 | - * Generate password |
|
521 | - */ |
|
522 | - for ($i = 0; $i < $length; $i++) { |
|
523 | - $num = mt_rand(0, $GLOBALS['_Text_Password_NumberOfPossibleCharacters'] - 1); |
|
524 | - $password .= $chars{$num}; |
|
525 | - } |
|
526 | - |
|
527 | - /** |
|
528 | - * Return password |
|
529 | - */ |
|
530 | - return $password; |
|
514 | + $chars = str_replace(array('+', '|', '$', '^', '/', '\\', ','), '', $chars); |
|
515 | + |
|
516 | + $GLOBALS['_Text_Password_NumberOfPossibleCharacters'] = strlen($chars); |
|
517 | + } |
|
518 | + |
|
519 | + /** |
|
520 | + * Generate password |
|
521 | + */ |
|
522 | + for ($i = 0; $i < $length; $i++) { |
|
523 | + $num = mt_rand(0, $GLOBALS['_Text_Password_NumberOfPossibleCharacters'] - 1); |
|
524 | + $password .= $chars{$num}; |
|
525 | + } |
|
526 | + |
|
527 | + /** |
|
528 | + * Return password |
|
529 | + */ |
|
530 | + return $password; |
|
531 | 531 | } |
532 | 532 | } |
533 | 533 | ?> |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | } |
47 | 47 | |
48 | 48 | $this->_edits = $this->_diff3($engine->diff($orig, $final1), |
49 | - $engine->diff($orig, $final2)); |
|
49 | + $engine->diff($orig, $final2)); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | /** |
@@ -58,11 +58,11 @@ discard block |
||
58 | 58 | if ($edit->isConflict()) { |
59 | 59 | /* FIXME: this should probably be moved somewhere else. */ |
60 | 60 | $lines = array_merge($lines, |
61 | - array('<<<<<<<' . ($label1 ? ' ' . $label1 : '')), |
|
62 | - $edit->final1, |
|
63 | - array("======="), |
|
64 | - $edit->final2, |
|
65 | - array('>>>>>>>' . ($label2 ? ' ' . $label2 : ''))); |
|
61 | + array('<<<<<<<' . ($label1 ? ' ' . $label1 : '')), |
|
62 | + $edit->final1, |
|
63 | + array("======="), |
|
64 | + $edit->final2, |
|
65 | + array('>>>>>>>' . ($label2 ? ' ' . $label2 : ''))); |
|
66 | 66 | $this->_conflictingBlocks++; |
67 | 67 | } else { |
68 | 68 | $lines = array_merge($lines, $edit->merged()); |
@@ -129,13 +129,13 @@ |
||
129 | 129 | * preserve whitespace as well. Therefore we split on words, |
130 | 130 | * but include all blocks of whitespace in the wordlist. */ |
131 | 131 | $diff = new Text_Diff('native', |
132 | - array($this->_splitOnWords($text1, $nl), |
|
132 | + array($this->_splitOnWords($text1, $nl), |
|
133 | 133 | $this->_splitOnWords($text2, $nl))); |
134 | 134 | |
135 | 135 | /* Get the diff in inline format. */ |
136 | 136 | $renderer = new Text_Diff_Renderer_inline |
137 | 137 | (array_merge($this->getParams(), |
138 | - array('split_level' => 'words'))); |
|
138 | + array('split_level' => 'words'))); |
|
139 | 139 | |
140 | 140 | /* Run the diff and get the output. */ |
141 | 141 | return str_replace($nl, "\n", $renderer->render($diff)) . "\n"; |
@@ -104,8 +104,8 @@ discard block |
||
104 | 104 | } |
105 | 105 | /* @todo */ |
106 | 106 | $output .= $this->_block($x0, $ntrail + $xi - $x0, |
107 | - $y0, $ntrail + $yi - $y0, |
|
108 | - $block); |
|
107 | + $y0, $ntrail + $yi - $y0, |
|
108 | + $block); |
|
109 | 109 | $block = false; |
110 | 110 | } |
111 | 111 | } |
@@ -136,8 +136,8 @@ discard block |
||
136 | 136 | |
137 | 137 | if (is_array($block)) { |
138 | 138 | $output .= $this->_block($x0, $xi - $x0, |
139 | - $y0, $yi - $y0, |
|
140 | - $block); |
|
139 | + $y0, $yi - $y0, |
|
140 | + $block); |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | return $output . $this->_endDiff(); |