Commit ec2edfb9 authored by Mike Sheldon's avatar Mike Sheldon

Fix truncation of long artist/album/track sent to gnukebox

parent 95a02f81
......@@ -62,7 +62,6 @@ function createArtistIfNew($artist) {
if(!$res) {
// Artist doesn't exist, so we create them
try {
$artist = substr($artist,0,255);
$res = $adodb->Execute('INSERT INTO Artist (name) VALUES (' . ($artist) . ')');
}
catch (exception $e) {
......@@ -75,8 +74,6 @@ function createAlbumIfNew($artist, $album) {
global $adodb;
try {
$artist = substr($artist,0,255);
$album = substr($album,0,255);
$name = $adodb->GetOne('SELECT name FROM Album WHERE lower(name) = lower(' . ($album) . ') AND lower(artist_name) = lower(' . ($artist) . ')');
}
catch (exception $e) {
......@@ -124,9 +121,6 @@ function getTrackCreateIfNew($artist, $album, $track, $mbid) {
if(!$res) {
// Create new track
try {
$track = substr($track,0,255);
$artist = substr($artist,0,255);
$album = substr($album,0,255);
$res = $adodb->Execute('INSERT INTO Track (name, artist_name, album_name, mbid) VALUES ('
. ($track) . ', '
. ($artist) . ', '
......
......@@ -43,7 +43,7 @@ for($i = 0; $i < count($_POST['a']); $i++) {
switch (mb_detect_encoding($_POST['a'][$i])) {
case "ASCII":
case "UTF-8":
$artist = $adodb->qstr(trim($_POST['a'][$i]));
$artist = $adodb->qstr(trim(substr($_POST['a'][$i], 0, 255)));
break;
default:
die("FAILED Bad encoding in artist submission $i\n");
......@@ -53,7 +53,7 @@ for($i = 0; $i < count($_POST['a']); $i++) {
switch (mb_detect_encoding($_POST['b'][$i])) {
case "ASCII":
case "UTF-8":
$album = $adodb->qstr(trim($_POST['b'][$i]));
$album = $adodb->qstr(trim(substr($_POST['b'][$i], 0, 255)));
break;
default:
die("FAILED Bad encoding in album submission $i\n");
......@@ -73,7 +73,7 @@ for($i = 0; $i < count($_POST['a']); $i++) {
switch (mb_detect_encoding($_POST['t'][$i])) {
case "ASCII":
case "UTF-8":
$track = $adodb->qstr(trim($_POST['t'][$i]));
$track = $adodb->qstr(trim(substr($_POST['t'][$i], 0, 255)));
break;
default:
die("FAILED Bad encoding in title submission $i\n");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment