ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
Efax.php
Go to the documentation of this file.
1<?php
2
4
7
10// available at http://getid3.sourceforge.net //
11// or http://www.getid3.org //
13// See readme.txt for more details //
15// //
16// module.archive.efax.php //
17// module for analyzing eFax files //
18// dependencies: NONE //
19// ///
21
29class Efax extends BaseHandler
30{
31
36 public function analyze()
37 {
38 $info = &$this->getid3->info;
39
40 fseek($this->getid3->fp, $info['avdataoffset'], SEEK_SET);
41 $efaxheader = fread($this->getid3->fp, 1024);
42
43 $info['efax']['header']['magic'] = substr($efaxheader, 0, 2);
44 if ($info['efax']['header']['magic'] != "\xDC\xFE") {
45 $info['error'][] = 'Invalid eFax byte order identifier (expecting DC FE, found '.Helper::PrintHexBytes($info['efax']['header']['magic']).') at offset '.$info['avdataoffset'];
46
47 return false;
48 }
49 $info['fileformat'] = 'efax';
50
51 $info['efax']['header']['filesize'] = Helper::LittleEndian2Int(substr($efaxheader, 2, 4));
52 if ($info['efax']['header']['filesize'] != $info['filesize']) {
53 $info['error'][] = 'Probable '.(($info['efax']['header']['filesize'] > $info['filesize']) ? 'truncated' : 'corrupt').' file, expecting '.$info['efax']['header']['filesize'].' bytes, found '.$info['filesize'].' bytes';
54 }
55 $info['efax']['header']['software1'] = rtrim(substr($efaxheader, 26, 32), "\x00");
56 $info['efax']['header']['software2'] = rtrim(substr($efaxheader, 58, 32), "\x00");
57 $info['efax']['header']['software3'] = rtrim(substr($efaxheader, 90, 32), "\x00");
58
59 $info['efax']['header']['pages'] = Helper::LittleEndian2Int(substr($efaxheader, 198, 2));
60 $info['efax']['header']['data_bytes'] = Helper::LittleEndian2Int(substr($efaxheader, 202, 4));
61
62$info['error'][] = 'eFax parsing not enabled in this version of GetId3Core() ['.$this->getid3->version().']';
63return false;
64
65 return true;
66 }
67
68}
An exception for terminatinating execution or to throw for unit testing.
GetId3() by James Heinrich info@getid3.org //.
Definition: BaseHandler.php:26
fseek($bytes, $whence=SEEK_SET)
GetId3() by James Heinrich info@getid3.org //.
Definition: Helper.php:27
static LittleEndian2Int($byteword, $signed=false)
Definition: Helper.php:413
GetId3() by James Heinrich info@getid3.org //.
Definition: Efax.php:30
$info
Definition: example_052.php:80