module.misc.msoffice.php 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. <?php
  2. /////////////////////////////////////////////////////////////////
  3. /// getID3() by James Heinrich <info@getid3.org> //
  4. // available at http://getid3.sourceforge.net //
  5. // or http://www.getid3.org //
  6. // also https://github.com/JamesHeinrich/getID3 //
  7. /////////////////////////////////////////////////////////////////
  8. // See readme.txt for more details //
  9. /////////////////////////////////////////////////////////////////
  10. // //
  11. // module.misc.msoffice.php //
  12. // module for analyzing MS Office (.doc, .xls, etc) files //
  13. // dependencies: NONE //
  14. // ///
  15. /////////////////////////////////////////////////////////////////
  16. class getid3_msoffice extends getid3_handler
  17. {
  18. public function Analyze() {
  19. $info = &$this->getid3->info;
  20. $this->fseek($info['avdataoffset']);
  21. $DOCFILEheader = $this->fread(8);
  22. $magic = "\xD0\xCF\x11\xE0\xA1\xB1\x1A\xE1";
  23. if (substr($DOCFILEheader, 0, 8) != $magic) {
  24. $info['error'][] = 'Expecting "'.getid3_lib::PrintHexBytes($magic).'" at '.$info['avdataoffset'].', found '.getid3_lib::PrintHexBytes(substr($DOCFILEheader, 0, 8)).' instead.';
  25. return false;
  26. }
  27. $info['fileformat'] = 'msoffice';
  28. $info['error'][] = 'MS Office (.doc, .xls, etc) parsing not enabled in this version of getID3() ['.$this->getid3->version().']';
  29. return false;
  30. }
  31. }