setOption(array('encoding'=>$TaggingFormat)); getid3_lib::IncludeDependency(GETID3_INCLUDEPATH.'write.php', __FILE__, true); $Filename = isset($_GET['file']) ? $_GET['file'] : die('Error'); if (isset($_POST['WriteTags'])) { $TagFormatsToWrite = (isset($_POST['TagFormatsToWrite']) ? $_POST['TagFormatsToWrite'] : array()); if (!empty($TagFormatsToWrite)) { $tagwriter = new getid3_writetags; $tagwriter->filename = $Filename; $tagwriter->tagformats = $TagFormatsToWrite; $tagwriter->overwrite_tags = true; $tagwriter->tag_encoding = $TaggingFormat; if (!empty($_POST['remove_other_tags'])) { $tagwriter->remove_other_tags = true; } $commonkeysarray = array('Title', 'Artist', 'Album', 'Year', 'Comment'); foreach ($commonkeysarray as $key) { if (!empty($_POST[$key])) { $TagData[strtolower($key)][] = $_POST[$key]; } } if (!empty($_POST['Genre'])) { $TagData['genre'][] = $_POST['Genre']; } if (!empty($_POST['GenreOther'])) { $TagData['genre'][] = $_POST['GenreOther']; } if (!empty($_POST['Track'])) { $TagData['track'][] = $_POST['Track'].(!empty($_POST['TracksTotal']) ? '/'.$_POST['TracksTotal'] : ''); } if (!empty($_FILES['userfile']['tmp_name'])) { if (in_array('id3v2.4', $tagwriter->tagformats) || in_array('id3v2.3', $tagwriter->tagformats) || in_array('id3v2.2', $tagwriter->tagformats)) { if (is_uploaded_file($_FILES['userfile']['tmp_name'])) { ob_start(); if ($fd = fopen($_FILES['userfile']['tmp_name'], 'rb')) { ob_end_clean(); $APICdata = fread($fd, filesize($_FILES['userfile']['tmp_name'])); fclose ($fd); list($APIC_width, $APIC_height, $APIC_imageTypeID) = GetImageSize($_FILES['userfile']['tmp_name']); $imagetypes = array(1=>'gif', 2=>'jpeg', 3=>'png'); if (isset($imagetypes[$APIC_imageTypeID])) { $TagData['attached_picture'][0]['data'] = $APICdata; $TagData['attached_picture'][0]['picturetypeid'] = $_POST['APICpictureType']; $TagData['attached_picture'][0]['description'] = $_FILES['userfile']['name']; $TagData['attached_picture'][0]['mime'] = 'image/'.$imagetypes[$APIC_imageTypeID]; } else { echo 'invalid image format (only GIF, JPEG, PNG)
'; } } else { $errormessage = ob_get_contents(); ob_end_clean(); echo 'cannot open '.$_FILES['userfile']['tmp_name'].'
'; } } else { echo '!is_uploaded_file('.$_FILES['userfile']['tmp_name'].')
'; } } else { echo 'WARNING: Can only embed images for ID3v2
'; } } $tagwriter->tag_data = $TagData; if ($tagwriter->WriteTags()) { echo '
Теги успешно сохранились
'; if (!empty($tagwriter->warnings)) { echo functions::display_error(implode('

', $tagwriter->warnings)); } } else { echo functions::display_error(implode('

', $tagwriter->errors)); } } else { echo '
Формат не поддерживается
'; } echo '
'; } echo '
Редактор тэгов
'; if (!empty($Filename)) { echo '
'; #echo ''; if (file_exists($Filename)) { // Initialize getID3 engine $getID3 = new getID3; $OldThisFileInfo = $getID3->analyze($Filename); getid3_lib::CopyTagsToComments($OldThisFileInfo); switch ($OldThisFileInfo['fileformat']) { case 'mp3': $ValidTagTypes = array('id3v1', 'id3v2.3'); break; default: $ValidTagTypes = array(); break; } echo '
Название
'; echo '
Артист
'; echo '
Альбом
'; echo '
Год
'; $TracksTotal = ''; $TrackNumber = ''; if (!empty($OldThisFileInfo['comments']['track_number']) && is_array($OldThisFileInfo['comments']['track_number'])) { $RawTrackNumberArray = $OldThisFileInfo['comments']['track_number']; } elseif (!empty($OldThisFileInfo['comments']['track']) && is_array($OldThisFileInfo['comments']['track'])) { $RawTrackNumberArray = $OldThisFileInfo['comments']['track']; } else { $RawTrackNumberArray = array(); } foreach ($RawTrackNumberArray as $key => $value) { if (strlen($value) > strlen($TrackNumber)) { // ID3v1 may store track as "3" but ID3v2/APE would store as "03/16" $TrackNumber = $value; } } if (strstr($TrackNumber, '/')) { list($TrackNumber, $TracksTotal) = explode('/', $TrackNumber); } echo '
Дорожка
из
'; $ArrayOfGenresTemp = getid3_id3v1::ArrayOfGenres(); // get the array of genres foreach ($ArrayOfGenresTemp as $key => $value) { // change keys to match displayed value $ArrayOfGenres[$value] = $value; } unset($ArrayOfGenresTemp); // remove temporary array unset($ArrayOfGenres['Cover']); // take off these special cases unset($ArrayOfGenres['Remix']); unset($ArrayOfGenres['Unknown']); $ArrayOfGenres[''] = '- Unknown -'; // Add special cases back in with renamed key/value $ArrayOfGenres['Cover'] = '-Cover-'; $ArrayOfGenres['Remix'] = '-Remix-'; asort($ArrayOfGenres); // sort into alphabetical order echo '
Стиль
'; echo '
Запись тегов
'; foreach ($ValidTagTypes as $ValidTagType) { echo '
'.$ValidTagType.'
'; } if (count($ValidTagTypes) > 1) { echo '
Удалить неотмеченные версии тегов
'; } echo '
Коментарий
'; echo '
Обложка
(ID3v2 only)
'; echo '


'; echo '
'; } else { echo '
Error
'.htmlentities($Filename).' файл не существует
'; } echo '
'; } echo '
Назад
'; require_once '../incfiles/end.php'; ?>