31 if (!ini_get(
'safe_mode')) {
34 $tempcommentsfilename = tempnam(
'*',
'getID3');
35 if ($fpcomments = @fopen($tempcommentsfilename,
'wb')) {
37 foreach ($this->tag_data as $key => $value) {
38 foreach ($value as $commentdata) {
46 $this->errors[] =
'failed to open temporary tags file "'.$tempcommentsfilename.
'", tags not written';
51 $oldignoreuserabort = ignore_user_abort(
true);
52 if (GETID3_OS_ISWINDOWS) {
54 if (file_exists(GETID3_HELPERAPPSDIR.
'vorbiscomment.exe')) {
65 $timestampbeforewriting = filemtime($this->filename);
67 $commandline = GETID3_HELPERAPPSDIR.
'vorbiscomment.exe -w --raw -c "'.$tempcommentsfilename.
'" "'.$this->filename.
'" 2>&1';
68 $VorbiscommentError = `$commandline`;
70 if (empty($VorbiscommentError)) {
72 if ($timestampbeforewriting == filemtime($this->filename)) {
73 $VorbiscommentError =
'File modification timestamp has not changed - it looks like the tags were not written';
77 $VorbiscommentError =
'vorbiscomment.exe not found in '.GETID3_HELPERAPPSDIR;
82 $commandline =
'vorbiscomment -w --raw -c "'.$tempcommentsfilename.
'" "'.$this->filename.
'" 2>&1';
83 $VorbiscommentError = `$commandline`;
88 unlink($tempcommentsfilename);
89 ignore_user_abort($oldignoreuserabort);
91 if (!empty($VorbiscommentError)) {
93 $this->errors[] =
'system call to vorbiscomment failed with message: '.
"\n\n".$VorbiscommentError;
101 $this->errors[] =
'PHP running in Safe Mode (backtick operator not available) - cannot call vorbiscomment, tags not written';
106 $this->tag_data = array(array());
118 return strtoupper(ereg_replace(
'[^ -<>-}]',
' ', str_replace(
"\x00",
' ', $originalcommentname)));