@@ -83,7 +83,7 @@ class ODPresentation extends AbstractReader implements ReaderInterface
83
83
protected $ oXMLReader ;
84
84
85
85
/**
86
- * @var \PhpOffice\Common\ XMLReader
86
+ * @var XMLReader
87
87
*/
88
88
protected $ oXMLMetaInfManifest ;
89
89
@@ -773,8 +773,8 @@ protected function loadStylesFile(): void
773
773
774
774
/**
775
775
* @param string $filename
776
+ *
776
777
* @return bool
777
- * @throws \Exception
778
778
*/
779
779
protected function loadFileFromODP ($ filename )
780
780
{
@@ -787,7 +787,7 @@ protected function loadFileFromODP($filename)
787
787
}
788
788
}
789
789
// Search file in META-INF/manifest.xml
790
- $ oElement = $ this ->oXMLMetaInfManifest ->getElement ('/manifest:manifest/manifest:file-entry[@manifest:full-path= \'' . $ filename. '\'] ' );
790
+ $ oElement = $ this ->oXMLMetaInfManifest ->getElement ('/manifest:manifest/manifest:file-entry[@manifest:full-path= \'' . $ filename . '\'] ' );
791
791
if (!$ oElement ) {
792
792
return false ;
793
793
}
@@ -798,14 +798,15 @@ protected function loadFileFromODP($filename)
798
798
}
799
799
800
800
$ fileContent = $ this ->oZip ->getFromName ($ filename );
801
- if (!$ fileContent ){
801
+ if (!$ fileContent ) {
802
802
return false ;
803
803
}
804
804
805
805
// No Encrypted file
806
806
if (!$ bEncrypted ) {
807
807
$ this ->oXMLReader = new XMLReader ();
808
808
$ this ->oXMLReader ->getDomFromString ($ fileContent );
809
+
809
810
return true ;
810
811
}
811
812
@@ -851,7 +852,7 @@ protected function loadFileFromODP($filename)
851
852
var_dump ($ iv );
852
853
853
854
$ pwdHash = hash ('sha256 ' , $ this ->getPassword ());
854
- echo 'sha256( ' . $ this ->getPassword (). '): ' ;
855
+ echo 'sha256( ' . $ this ->getPassword () . '): ' ;
855
856
var_dump ($ pwdHash );
856
857
//$pwdHash = substr($pwdHash, 0 , 32);
857
858
//var_dump($pwdHash);
@@ -864,15 +865,15 @@ protected function loadFileFromODP($filename)
864
865
//var_dump($key);
865
866
866
867
$ data = openssl_decrypt ($ fileContent , 'AES-256-CBC ' , $ key , 0 , $ iv );
867
- if (!$ data ) {
868
- while ($ msg = openssl_error_string ())
868
+ if (!$ data ) {
869
+ while ($ msg = openssl_error_string ()) {
869
870
var_dump ($ msg );
871
+ }
870
872
die ();
871
- } else {
872
- var_dump ($ data );
873
- $ data = gzinflate ($ data );
874
- var_dump ($ data );
875
873
}
874
+ var_dump ($ data );
875
+ $ data = gzinflate ($ data );
876
+ var_dump ($ data );
876
877
877
878
/*$data = mcrypt_decrypt(MCRYPT_RIJNDAEL_128, $key, $fileContent, MCRYPT_MODE_CBC, $iv);
878
879
var_dump($data);
@@ -884,18 +885,16 @@ protected function loadFileFromODP($filename)
884
885
return false ;
885
886
}
886
887
887
- protected function hash_pbkdf2 ($ a = ' sha256 ' , $ password , $ salt , $ rounds = 5000 , $ key_length = 32 , $ raw_output = false )
888
+ protected function hash_pbkdf2 ($ a , $ password , $ salt , $ rounds = 5000 , $ key_length = 32 , $ raw_output = false )
888
889
{
889
890
// Derived key
890
891
$ dk = '' ;
891
892
// Create key
892
- for ($ block =1 ; $ block <=$ key_length ; $ block ++)
893
- {
893
+ for ($ block = 1 ; $ block <= $ key_length ; ++$ block ) {
894
894
// Initial hash for this block
895
895
$ ib = $ h = hash_hmac ($ a , $ salt . pack ('N ' , $ block ), $ password , true );
896
896
// Perform block iterations
897
- for ($ i =1 ; $ i <$ rounds ; $ i ++)
898
- {
897
+ for ($ i = 1 ; $ i < $ rounds ; ++$ i ) {
899
898
// XOR each iteration
900
899
$ ib ^= ($ h = hash_hmac ($ a , $ h , $ password , true ));
901
900
}
@@ -904,6 +903,7 @@ protected function hash_pbkdf2($a = 'sha256', $password, $salt, $rounds = 5000,
904
903
}
905
904
// Return derived key of correct length
906
905
$ key = substr ($ dk , 0 , $ key_length );
906
+
907
907
return $ raw_output ? $ key : base64_encode ($ key );
908
908
}
909
909
0 commit comments