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.
'metaflac.exe')) {
65 $timestampbeforewriting = filemtime($this->filename);
67 $commandline = GETID3_HELPERAPPSDIR.
'metaflac.exe --no-utf8-convert --remove-vc-all --import-vc-from="'.$tempcommentsfilename.
'" "'.$this->filename.
'" 2>&1';
68 $metaflacError = `$commandline`;
70 if (empty($metaflacError)) {
72 if ($timestampbeforewriting == filemtime($this->filename)) {
73 $metaflacError =
'File modification timestamp has not changed - it looks like the tags were not written';
77 $metaflacError =
'metaflac.exe not found in '.GETID3_HELPERAPPSDIR;
83 $commandline =
'metaflac --no-utf8-convert --remove-vc-all --import-vc-from='.$tempcommentsfilename.
' "'.$this->filename.
'" 2>&1';
84 $metaflacError = `$commandline`;
89 unlink($tempcommentsfilename);
90 ignore_user_abort($oldignoreuserabort);
92 if (!empty($metaflacError)) {
94 $this->errors[] =
'System call to metaflac failed with this message returned: '.
"\n\n".$metaflacError;
102 $this->errors[] =
'PHP running in Safe Mode (backtick operator not available) - cannot call metaflac, tags not written';
109 if (!ini_get(
'safe_mode')) {
111 $oldignoreuserabort = ignore_user_abort(
true);
112 if (GETID3_OS_ISWINDOWS) {
114 if (file_exists(GETID3_HELPERAPPSDIR.
'metaflac.exe')) {
117 $timestampbeforewriting = filemtime($this->filename);
119 $commandline = GETID3_HELPERAPPSDIR.
'metaflac.exe --remove-vc-all "'.$this->filename.
'" 2>&1';
120 $metaflacError = `$commandline`;
122 if (empty($metaflacError)) {
124 if ($timestampbeforewriting == filemtime($this->filename)) {
125 $metaflacError =
'File modification timestamp has not changed - it looks like the tags were not deleted';
129 $metaflacError =
'metaflac.exe not found in '.GETID3_HELPERAPPSDIR;
135 $commandline =
'metaflac --remove-vc-all "'.$this->filename.
'" 2>&1';
136 $metaflacError = `$commandline`;
140 ignore_user_abort($oldignoreuserabort);
142 if (!empty($metaflacError)) {
143 $this->errors[] =
'System call to metaflac failed with this message returned: '.
"\n\n".$metaflacError;
148 $this->errors[] =
'PHP running in Safe Mode (backtick operator not available) - cannot call metaflac, tags not deleted';
161 return strtoupper(ereg_replace(
'[^ -<>-}]',
' ', str_replace(
"\x00",
' ', $originalcommentname)));