Changeset 41196 for trunk/src/wp-includes/ID3/module.tag.apetag.php
- Timestamp:
- 07/31/2017 07:49:31 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/ID3/module.tag.apetag.php
r32979 r41196 24 24 25 25 if (!getid3_lib::intValueSupported($info['filesize'])) { 26 $ info['warning'][] = 'Unable to check for APEtags because file is larger than '.round(PHP_INT_MAX / 1073741824).'GB';26 $this->warning('Unable to check for APEtags because file is larger than '.round(PHP_INT_MAX / 1073741824).'GB'); 27 27 return false; 28 28 } … … 73 73 $APEfooterData = $this->fread(32); 74 74 if (!($thisfile_ape['footer'] = $this->parseAPEheaderFooter($APEfooterData))) { 75 $ info['error'][] = 'Error parsing APE footer at offset '.$thisfile_ape['tag_offset_end'];75 $this->error('Error parsing APE footer at offset '.$thisfile_ape['tag_offset_end']); 76 76 return false; 77 77 } … … 89 89 90 90 if (isset($info['id3v1']['tag_offset_start']) && ($info['id3v1']['tag_offset_start'] < $thisfile_ape['tag_offset_end'])) { 91 $ info['warning'][] = 'ID3v1 tag information ignored since it appears to be a false synch in APEtag data';91 $this->warning('ID3v1 tag information ignored since it appears to be a false synch in APEtag data'); 92 92 unset($info['id3v1']); 93 93 foreach ($info['warning'] as $key => $value) { … … 105 105 $offset += $apetagheadersize; 106 106 } else { 107 $ info['error'][] = 'Error parsing APE header at offset '.$thisfile_ape['tag_offset_start'];107 $this->error('Error parsing APE header at offset '.$thisfile_ape['tag_offset_start']); 108 108 return false; 109 109 } … … 120 120 $offset += 4; 121 121 if (strstr(substr($APEtagData, $offset), "\x00") === false) { 122 $ info['error'][] = 'Cannot find null-byte (0x00) seperator between ItemKey #'.$i.' and value. ItemKey starts '.$offset.' bytes into the APE tag, at file offset '.($thisfile_ape['tag_offset_start'] + $offset);122 $this->error('Cannot find null-byte (0x00) separator between ItemKey #'.$i.' and value. ItemKey starts '.$offset.' bytes into the APE tag, at file offset '.($thisfile_ape['tag_offset_start'] + $offset)); 123 123 return false; 124 124 } … … 155 155 $thisfile_replaygain['track']['originator'] = 'unspecified'; 156 156 } else { 157 $ info['warning'][] = 'MP3gainTrackGain value in APEtag appears invalid: "'.$thisfile_ape_items_current['data'][0].'"';157 $this->warning('MP3gainTrackGain value in APEtag appears invalid: "'.$thisfile_ape_items_current['data'][0].'"'); 158 158 } 159 159 break; … … 164 164 $thisfile_replaygain['track']['originator'] = 'unspecified'; 165 165 if ($thisfile_replaygain['track']['peak'] <= 0) { 166 $ info['warning'][] = 'ReplayGain Track peak from APEtag appears invalid: '.$thisfile_replaygain['track']['peak'].' (original value = "'.$thisfile_ape_items_current['data'][0].'")';167 } 168 } else { 169 $ info['warning'][] = 'MP3gainTrackPeak value in APEtag appears invalid: "'.$thisfile_ape_items_current['data'][0].'"';166 $this->warning('ReplayGain Track peak from APEtag appears invalid: '.$thisfile_replaygain['track']['peak'].' (original value = "'.$thisfile_ape_items_current['data'][0].'")'); 167 } 168 } else { 169 $this->warning('MP3gainTrackPeak value in APEtag appears invalid: "'.$thisfile_ape_items_current['data'][0].'"'); 170 170 } 171 171 break; … … 176 176 $thisfile_replaygain['album']['originator'] = 'unspecified'; 177 177 } else { 178 $ info['warning'][] = 'MP3gainAlbumGain value in APEtag appears invalid: "'.$thisfile_ape_items_current['data'][0].'"';178 $this->warning('MP3gainAlbumGain value in APEtag appears invalid: "'.$thisfile_ape_items_current['data'][0].'"'); 179 179 } 180 180 break; … … 185 185 $thisfile_replaygain['album']['originator'] = 'unspecified'; 186 186 if ($thisfile_replaygain['album']['peak'] <= 0) { 187 $ info['warning'][] = 'ReplayGain Album peak from APEtag appears invalid: '.$thisfile_replaygain['album']['peak'].' (original value = "'.$thisfile_ape_items_current['data'][0].'")';188 } 189 } else { 190 $ info['warning'][] = 'MP3gainAlbumPeak value in APEtag appears invalid: "'.$thisfile_ape_items_current['data'][0].'"';187 $this->warning('ReplayGain Album peak from APEtag appears invalid: '.$thisfile_replaygain['album']['peak'].' (original value = "'.$thisfile_ape_items_current['data'][0].'")'); 188 } 189 } else { 190 $this->warning('MP3gainAlbumPeak value in APEtag appears invalid: "'.$thisfile_ape_items_current['data'][0].'"'); 191 191 } 192 192 break; … … 199 199 $thisfile_replaygain['mp3gain']['undo_wrap'] = (($mp3gain_undo_wrap == 'Y') ? true : false); 200 200 } else { 201 $ info['warning'][] = 'MP3gainUndo value in APEtag appears invalid: "'.$thisfile_ape_items_current['data'][0].'"';201 $this->warning('MP3gainUndo value in APEtag appears invalid: "'.$thisfile_ape_items_current['data'][0].'"'); 202 202 } 203 203 break; … … 209 209 $thisfile_replaygain['mp3gain']['globalgain_track_max'] = intval($mp3gain_globalgain_max); 210 210 } else { 211 $ info['warning'][] = 'MP3gainMinMax value in APEtag appears invalid: "'.$thisfile_ape_items_current['data'][0].'"';211 $this->warning('MP3gainMinMax value in APEtag appears invalid: "'.$thisfile_ape_items_current['data'][0].'"'); 212 212 } 213 213 break; … … 219 219 $thisfile_replaygain['mp3gain']['globalgain_album_max'] = intval($mp3gain_globalgain_album_max); 220 220 } else { 221 $ info['warning'][] = 'MP3gainAlbumMinMax value in APEtag appears invalid: "'.$thisfile_ape_items_current['data'][0].'"';221 $this->warning('MP3gainAlbumMinMax value in APEtag appears invalid: "'.$thisfile_ape_items_current['data'][0].'"'); 222 222 } 223 223 break; … … 254 254 // list of possible cover arts from http://taglib-sharp.sourcearchive.com/documentation/2.0.3.0-2/Ape_2Tag_8cs-source.html 255 255 if (is_array($thisfile_ape_items_current['data'])) { 256 $ info['warning'][] = 'APEtag "'.$item_key.'" should be flagged as Binary data, but was incorrectly flagged as UTF-8';256 $this->warning('APEtag "'.$item_key.'" should be flagged as Binary data, but was incorrectly flagged as UTF-8'); 257 257 $thisfile_ape_items_current['data'] = implode("\x00", $thisfile_ape_items_current['data']); 258 258 } … … 261 261 $thisfile_ape_items_current['data_length'] = strlen($thisfile_ape_items_current['data']); 262 262 263 $thisfile_ape_items_current['image_mime'] = '';264 $imageinfo = array();265 $imagechunkcheck = getid3_lib::GetDataImageSize($thisfile_ape_items_current['data'], $imageinfo);266 $thisfile_ape_items_current['image_mime'] = image_type_to_mime_type($imagechunkcheck[2]);267 268 263 do { 264 $thisfile_ape_items_current['image_mime'] = ''; 265 $imageinfo = array(); 266 $imagechunkcheck = getid3_lib::GetDataImageSize($thisfile_ape_items_current['data'], $imageinfo); 267 if (($imagechunkcheck === false) || !isset($imagechunkcheck[2])) { 268 $this->warning('APEtag "'.$item_key.'" contains invalid image data'); 269 break; 270 } 271 $thisfile_ape_items_current['image_mime'] = image_type_to_mime_type($imagechunkcheck[2]); 272 269 273 if ($this->inline_attachments === false) { 270 274 // skip entirely … … 277 281 if ($this->inline_attachments < $thisfile_ape_items_current['data_length']) { 278 282 // too big, skip 279 $ info['warning'][] = 'attachment at '.$thisfile_ape_items_current['offset'].' is too large to process inline ('.number_format($thisfile_ape_items_current['data_length']).' bytes)';283 $this->warning('attachment at '.$thisfile_ape_items_current['offset'].' is too large to process inline ('.number_format($thisfile_ape_items_current['data_length']).' bytes)'); 280 284 unset($thisfile_ape_items_current['data']); 281 285 break; … … 283 287 } elseif (is_string($this->inline_attachments)) { 284 288 $this->inline_attachments = rtrim(str_replace(array('/', '\\'), DIRECTORY_SEPARATOR, $this->inline_attachments), DIRECTORY_SEPARATOR); 285 if (!is_dir($this->inline_attachments) || ! is_writable($this->inline_attachments)) {289 if (!is_dir($this->inline_attachments) || !getID3::is_writable($this->inline_attachments)) { 286 290 // cannot write, skip 287 $ info['warning'][] = 'attachment at '.$thisfile_ape_items_current['offset'].' cannot be saved to "'.$this->inline_attachments.'" (not writable)';291 $this->warning('attachment at '.$thisfile_ape_items_current['offset'].' cannot be saved to "'.$this->inline_attachments.'" (not writable)'); 288 292 unset($thisfile_ape_items_current['data']); 289 293 break; … … 293 297 if (is_string($this->inline_attachments)) { 294 298 $destination_filename = $this->inline_attachments.DIRECTORY_SEPARATOR.md5($info['filenamepath']).'_'.$thisfile_ape_items_current['data_offset']; 295 if (!file_exists($destination_filename) || is_writable($destination_filename)) {299 if (!file_exists($destination_filename) || getID3::is_writable($destination_filename)) { 296 300 file_put_contents($destination_filename, $thisfile_ape_items_current['data']); 297 301 } else { 298 $ info['warning'][] = 'attachment at '.$thisfile_ape_items_current['offset'].' cannot be saved to "'.$destination_filename.'" (not writable)';302 $this->warning('attachment at '.$thisfile_ape_items_current['offset'].' cannot be saved to "'.$destination_filename.'" (not writable)'); 299 303 } 300 304 $thisfile_ape_items_current['data_filename'] = $destination_filename;
Note: See TracChangeset
for help on using the changeset viewer.