@@ -603,7 +603,7 @@ discard block |
||
| 603 | 603 | print " Added photo: " . basename($photo_file) . PHP_EOL; |
| 604 | 604 | } |
| 605 | 605 | else |
| 606 | - print " WARNING: Only jpg contact photos are currently supported." . PHP_EOL; |
|
| 606 | + print " WARNING: Only jpg contact photos are currently supported." . PHP_EOL; |
|
| 607 | 607 | } |
| 608 | 608 | elseif(substr($entry['photo_data'][0], 0, 4) == 'http') |
| 609 | 609 | { |
@@ -668,19 +668,19 @@ discard block |
||
| 668 | 668 | fclose($output); |
| 669 | 669 | print " Saved to file " . $this->config['output_file'] . PHP_EOL; |
| 670 | 670 | } |
| 671 | - if (array_key_exists('output_and_upload', $this->config) and $this->config['output_and_upload']) |
|
| 672 | - { |
|
| 673 | - $newphonebhash = md5(preg_replace("/<mod_time>(\\d{10})/","",file_get_contents($this->config['output_file'],'r'),-1,$debugnewtsreplace)); |
|
| 674 | - print " INFO: Compare old and new phonebook file versions." . PHP_EOL . " INFO: old version: " . $oldphonebhash . PHP_EOL . " INFO: new version: " . $newphonebhash . PHP_EOL; |
|
| 675 | - if($oldphonebhash === $newphonebhash) |
|
| 676 | - { |
|
| 677 | - print " INFO: Same versions ==> No changes in phonebook or images" . PHP_EOL . " EXIT: No need to upload phonebook to the FRITZ!Box.". PHP_EOL; |
|
| 678 | - return 0; |
|
| 679 | - } |
|
| 680 | - else |
|
| 681 | - print " INFO: Different versions ==> Changes in phonebook." . PHP_EOL . " INFO: Changes dedected! Continue with upload." . PHP_EOL; |
|
| 671 | + if (array_key_exists('output_and_upload', $this->config) and $this->config['output_and_upload']) |
|
| 672 | + { |
|
| 673 | + $newphonebhash = md5(preg_replace("/<mod_time>(\\d{10})/","",file_get_contents($this->config['output_file'],'r'),-1,$debugnewtsreplace)); |
|
| 674 | + print " INFO: Compare old and new phonebook file versions." . PHP_EOL . " INFO: old version: " . $oldphonebhash . PHP_EOL . " INFO: new version: " . $newphonebhash . PHP_EOL; |
|
| 675 | + if($oldphonebhash === $newphonebhash) |
|
| 676 | + { |
|
| 677 | + print " INFO: Same versions ==> No changes in phonebook or images" . PHP_EOL . " EXIT: No need to upload phonebook to the FRITZ!Box.". PHP_EOL; |
|
| 678 | + return 0; |
|
| 679 | + } |
|
| 680 | + else |
|
| 681 | + print " INFO: Different versions ==> Changes in phonebook." . PHP_EOL . " INFO: Changes dedected! Continue with upload." . PHP_EOL; |
|
| 682 | 682 | } |
| 683 | - else |
|
| 683 | + else |
|
| 684 | 684 | return 0; |
| 685 | 685 | } |
| 686 | 686 | // now we upload the photo jpgs first being stored in the |
@@ -811,10 +811,10 @@ discard block |
||
| 811 | 811 | ); |
| 812 | 812 | |
| 813 | 813 | $filefileds = array('PhonebookImportFile' => array( |
| 814 | - 'type' => 'text/xml', |
|
| 815 | - 'filename' => 'updatepb.xml', |
|
| 816 | - 'content' => $this->fbxml, |
|
| 817 | - ) |
|
| 814 | + 'type' => 'text/xml', |
|
| 815 | + 'filename' => 'updatepb.xml', |
|
| 816 | + 'content' => $this->fbxml, |
|
| 817 | + ) |
|
| 818 | 818 | ); |
| 819 | 819 | |
| 820 | 820 | $raw_result = $fritz->doPostFile($formfields, $filefileds); // send the command |
@@ -660,7 +660,7 @@ discard block |
||
| 660 | 660 | if(array_key_exists('output_file', $this->config)) |
| 661 | 661 | { |
| 662 | 662 | // build md5 hash of previous stored xml without <mod_time> Elements |
| 663 | - $oldphonebhash = md5(preg_replace("/<mod_time>(\\d{10})/","",file_get_contents($this->config['output_file'],'r'),-1,$debugoldtsreplace)); |
|
| 663 | + $oldphonebhash = md5(preg_replace("/<mod_time>(\\d{10})/", "", file_get_contents($this->config['output_file'], 'r'), -1, $debugoldtsreplace)); |
|
| 664 | 664 | $output = fopen($this->config['output_file'], 'w'); |
| 665 | 665 | if($output) |
| 666 | 666 | { |
@@ -668,13 +668,13 @@ discard block |
||
| 668 | 668 | fclose($output); |
| 669 | 669 | print " Saved to file " . $this->config['output_file'] . PHP_EOL; |
| 670 | 670 | } |
| 671 | - if (array_key_exists('output_and_upload', $this->config) and $this->config['output_and_upload']) |
|
| 671 | + if(array_key_exists('output_and_upload', $this->config) and $this->config['output_and_upload']) |
|
| 672 | 672 | { |
| 673 | - $newphonebhash = md5(preg_replace("/<mod_time>(\\d{10})/","",file_get_contents($this->config['output_file'],'r'),-1,$debugnewtsreplace)); |
|
| 673 | + $newphonebhash = md5(preg_replace("/<mod_time>(\\d{10})/", "", file_get_contents($this->config['output_file'], 'r'), -1, $debugnewtsreplace)); |
|
| 674 | 674 | print " INFO: Compare old and new phonebook file versions." . PHP_EOL . " INFO: old version: " . $oldphonebhash . PHP_EOL . " INFO: new version: " . $newphonebhash . PHP_EOL; |
| 675 | 675 | if($oldphonebhash === $newphonebhash) |
| 676 | 676 | { |
| 677 | - print " INFO: Same versions ==> No changes in phonebook or images" . PHP_EOL . " EXIT: No need to upload phonebook to the FRITZ!Box.". PHP_EOL; |
|
| 677 | + print " INFO: Same versions ==> No changes in phonebook or images" . PHP_EOL . " EXIT: No need to upload phonebook to the FRITZ!Box." . PHP_EOL; |
|
| 678 | 678 | return 0; |
| 679 | 679 | } |
| 680 | 680 | else |