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

Commit d7b38eda authored by elleo's avatar elleo

Update more string quoting to match the code standards

parent ee6f28dd
......@@ -18,24 +18,24 @@
*/
require_once("../database.php");
require_once("radio-utils.php");
require_once('../database.php');
require_once('radio-utils.php');
if(!isset($_GET['session']) || !isset($_GET['url'])) {
die("FAILED\n");
}
$session = $_GET["session"];
$url = $_GET["url"];
$session = $_GET['session'];
$url = $_GET['url'];
$res = $mdb2->query("SELECT username FROM Radio_Sessions WHERE session = " . $mdb2->quote($session, "text"));
$res = $mdb2->query('SELECT username FROM Radio_Sessions WHERE session = ' . $mdb2->quote($session, 'text'));
if(!$res->numRows()) {
die("BADSESSION\n");
}
if(ereg("^(globaltags|artist)/[^:]+$", $url, $regs)) {
$url = "librefm://" . $url; // compensate for shell-fm sending incomplete urls
if(ereg('^(globaltags|artist)/[^:]+$', $url, $regs)) {
$url = 'librefm://' . $url; // compensate for shell-fm sending incomplete urls
}
$stationname=radio_title_from_url($url);
......@@ -43,7 +43,7 @@ if($stationname=="FAILED") {
die("FAILED Unavailable station\n");
}
$mdb2->exec("UPDATE Radio_Sessions SET url = " . $mdb2->quote($url, "text") . " WHERE session = " . $mdb2->quote($session, "text"));
$mdb2->exec('UPDATE Radio_Sessions SET url = ' . $mdb2->quote($url, 'text') . ' WHERE session = ' . $mdb2->quote($session, 'text'));
echo "response=OK\n";
echo "url=http://libre.fm\n"; // Need to parse the station request and give a real URL
......
......@@ -18,7 +18,7 @@
*/
require_once("../database.php");
require_once('../database.php');
if(!isset($_GET['username']) || !isset($_GET['passwordmd5'])) {
die("BADAUTH\n");
......@@ -27,20 +27,20 @@ if(!isset($_GET['username']) || !isset($_GET['passwordmd5'])) {
$username = $_GET['username'];
$passmd5 = $_GET['passwordmd5'];
$res = $mdb2->query("SELECT username FROM Users WHERE username = " . $mdb2->quote($username, "text") . " AND password = " . $mdb2->quote($passmd5, "text"));
$res = $mdb2->query('SELECT username FROM Users WHERE username = ' . $mdb2->quote($username, 'text') . ' AND password = ' . $mdb2->quote($passmd5, 'text'));
if (!$res->numRows()) {
die("BADAUTH\n");
}
$session = md5($passmd5 . time());
$mdb2->exec("DELETE FROM Radio_Sessions WHERE expires < " . $mdb2->quote(time(), "integer"));
$mdb2->exec('DELETE FROM Radio_Sessions WHERE expires < ' . $mdb2->quote(time(), 'integer'));
$mdb2->query("INSERT INTO Radio_Sessions (username, session, expires) VALUES ( " . $mdb2->quote($username, "text") . ", " . $mdb2->quote($session, "text") . ", " . $mdb2->quote(time() + 259200,"integer") . ")");
$mdb2->query('INSERT INTO Radio_Sessions (username, session, expires) VALUES ( ' . $mdb2->quote($username, 'text"' . ', ' . $mdb2->quote($session, "text") . ', ' . $mdb2->quote(time() + 259200,'integer') . ')');
echo "session=" . $session . "\n";
echo "stream_url=this.is.broken.$username.example.com\n";
echo 'session=' . $session . "\n";
echo "stream_url=this.is.broken.{$username}.example.com\n";
echo "subscriber=0\n";
echo "framehack=0..\n";
echo "base_url=alpha.libre.fm\n";
......
......@@ -20,16 +20,16 @@
function radio_title_from_url($url) {
if(ereg("l(ast|ibre)fm://globaltags/(.*)", $url, $regs)) {
if(ereg('l(ast|ibre)fm://globaltags/(.*)', $url, $regs)) {
$tag = $regs[2];
return "Libre.fm " . ucwords($tag) . " Tag Radio";
return 'Libre.fm ' . ucwords($tag) . ' Tag Radio';
}
if(ereg("l(ast|ibre)fm://artist/(.*)/similarartists", $url, $regs)) {
if(ereg('l(ast|ibre)fm://artist/(.*)/similarartists', $url, $regs)) {
$artist = $regs[2];
return "Libre.fm " . $artist . " Artist Radio";
return 'Libre.fm ' . $artist . ' Artist Radio';
}
return "FAILED";
return 'FAILED';
}
?>
......@@ -21,7 +21,7 @@
require_once('../database.php');
require_once('../templating.php');
require_once('../data/Track.php');
require_once("radio-utils.php");
require_once('radio-utils.php');
// These deaths should probably just return an empty playlist
......@@ -29,9 +29,9 @@ if(!isset($_GET['sk']) || !isset($_GET['desktop'])) {
die("BADSESSION\n"); // this should return a blank dummy playlist instead
}
$session = $_GET["sk"];
$session = $_GET['sk'];
$res = $mdb2->query("SELECT url FROM Radio_Sessions WHERE session = " . $mdb2->quote($session, "text"));
$res = $mdb2->query('SELECT url FROM Radio_Sessions WHERE session = ' . $mdb2->quote($session, 'text'));
if(!$res->numRows()) {
die("BADSESSION\n"); // this should return a blank dummy playlist instead
......@@ -42,12 +42,12 @@ $url = $res->fetchOne(0);
$title = radio_title_from_url($url);
$smarty->assign('title', $title);
if(ereg("l(ast|ibre)fm://globaltags/(.*)", $url, $regs)) {
if(ereg('l(ast|ibre)fm://globaltags/(.*)', $url, $regs)) {
$tag = $regs[2];
$res = $mdb2->query("SELECT Track.name, Track.artist_name, Track.album_name FROM Track INNER JOIN Tags ON Track.name=Tags.track AND Track.artist_name=Tags.artist AND Track.album_name=Tags.album WHERE streamurl<>'' AND streamable=1 AND lower(tag) = " . $mdb2->quote(mb_strtolower($tag, "UTF-8"), "text"));
} elseif(ereg("l(ast|ibre)fm://artist/(.*)/similarartists", $url, $regs)) {
$res = $mdb2->query('SELECT Track.name, Track.artist_name, Track.album_name FROM Track INNER JOIN Tags ON Track.name=Tags.track AND Track.artist_name=Tags.artist AND Track.album_name=Tags.album WHERE streamurl<>\'\' AND streamable=1 AND lower(tag) = ' . $mdb2->quote(mb_strtolower($tag, 'UTF-8'), 'text'));
} elseif(ereg('l(ast|ibre)fm://artist/(.*)/similarartists', $url, $regs)) {
$artist = $regs[2];
$res = $mdb2->query("SELECT name, artist_name, album_name FROM Track WHERE streamurl<>'' AND streamable=1 AND lower(artist_name) = " . $mdb2->quote(mb_strtolower($artist, "UTF-8"), "text"));
$res = $mdb2->query('SELECT name, artist_name, album_name FROM Track WHERE streamurl<>\'\' AND streamable=1 AND lower(artist_name) = ' . $mdb2->quote(mb_strtolower($artist, 'UTF-8'), 'text'));
} else {
die("FAILED\n"); // this should return a blank dummy playlist instead
}
......@@ -70,9 +70,9 @@ $radiotracks = array();
$res->seek($tr[$i]);
$row = $res->fetchRow(MDB2_FETCHMODE_ASSOC);
$track = new Track($row["name"], $row["artist_name"]);
$album = new Album($row["album_name"], $row["artist_name"]);
$artist = new Artist($row["artist_name"]);
$track = new Track($row['name'], $row['artist_name']);
$album = new Album($row['album_name'], $row['artist_name']);
$artist = new Artist($row['artist_name']);
if($track->duration == 0) {
$duration = 180000;
......@@ -80,17 +80,17 @@ $radiotracks = array();
$duration = $track->duration * 1000;
}
$radiotracks[$i]["location"] = $track->streamurl;
$radiotracks[$i]["title"] = $track->name;
$radiotracks[$i]["id"] = "0000";
$radiotracks[$i]["album"] = $album->name;
$radiotracks[$i]["creator"] = $artist->name;
$radiotracks[$i]["duration"] = $duration;
$radiotracks[$i]["image"] = $album->image;
$radiotracks[$i]["artisturl"] = $artist->getURL();
$radiotracks[$i]["albumurl"] = $album->getURL();
$radiotracks[$i]["trackurl"] = $track->getURL();
$radiotracks[$i]["downloadurl"] = $track->getURL();
$radiotracks[$i]['location'] = $track->streamurl;
$radiotracks[$i]['title'] = $track->name;
$radiotracks[$i]['id'] = "0000";
$radiotracks[$i]['album'] = $album->name;
$radiotracks[$i]['creator'] = $artist->name;
$radiotracks[$i]['duration'] = $duration;
$radiotracks[$i]['image'] = $album->image;
$radiotracks[$i]['artisturl'] = $artist->getURL();
$radiotracks[$i]['albumurl'] = $album->getURL();
$radiotracks[$i]['trackurl'] = $track->getURL();
$radiotracks[$i]['downloadurl'] = $track->getURL();
}
......
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