We are no longer offering accounts on this server. Consider https://gitlab.freedesktop.org/ as a place to host projects.

Commit f93cdac8 authored by jurgbohn's avatar jurgbohn

Hope this unbreaks it :)

parent c93458b5
......@@ -22,14 +22,14 @@ function usernameFromSID($session_id) {
function createArtistIfNew($artist) {
global $mdb2;
$res = $mdb2->query("SELECT name FROM Artist WHERE name = " . utf8html($artist));
$res = $mdb2->query("SELECT name FROM Artist WHERE name = " . ($artist));
if(PEAR::isError($res)) {
die("FAILED " . $res->getMessage());
}
if(!$res->numRows()) {
// Artist doesn't exist, so we create them
$res = $mdb2->query("INSERT INTO Artist (name) VALUES (" . utf8html($artist) . ")");
$res = $mdb2->query("INSERT INTO Artist (name) VALUES (" . ($artist) . ")");
if(PEAR::isError($res)) {
die("FAILED " . $res->getMessage());
}
......@@ -39,14 +39,14 @@ function createArtistIfNew($artist) {
function createAlbumIfNew($artist, $album) {
global $mdb2;
$res = $mdb2->query("SELECT name FROM Album WHERE name = " . utf8html($album));
$res = $mdb2->query("SELECT name FROM Album WHERE name = " . ($album));
if(PEAR::isError($res)) {
die("FAILED " . $res->getMessage());
}
if(!$res->numRows()) {
// Album doesn't exist, so create it
$res = $mdb2->query("INSERT INTO Album (name, artist_name) VALUES (" . utf8html($album) . ", " . utf8html($artist) . ")");
$res = $mdb2->query("INSERT INTO Album (name, artist_name) VALUES (" . ($album) . ", " . ($artist) . ")");
if(PEAR::isError($res)) {
die("FAILED " . $res->getMessage());
}
......@@ -56,7 +56,7 @@ function createAlbumIfNew($artist, $album) {
function createTrackIfNew($artist, $album, $track, $mbid) {
global $mdb2;
$res = $mdb2->query("SELECT name FROM Track WHERE name = " . utf8html($track) . " AND artist = " . utf8html($artist));
$res = $mdb2->query("SELECT name FROM Track WHERE name = " . ($track) . " AND artist = " . ($artist));
if(PEAR::isError($res)) {
die("FAILED " . $res->getMessage());
}
......@@ -64,17 +64,13 @@ function createTrackIfNew($artist, $album, $track, $mbid) {
if(!$res->numRows()) {
// Create new track
$res = $mdb2->query("INSERT INTO Track (name, artist, album, mbid) VALUES ("
. utf8html($track) . ", "
. utf8html($artist) . ", "
. utf8html($album) . ", "
. utf8html($mbid) . ")");
. ($track) . ", "
. ($artist) . ", "
. ($album) . ", "
. ($mbid) . ")");
if(PEAR::isError($res)) {
die("FAILED " . $res->getMessage());
}
}
}
function utf8html(&$input) {
$input = utf8_encode(htmlentities($input));
}
?>
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