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

Commit ab262c39 authored by clint's avatar clint

undo r1488

parent 1ffcfb27
......@@ -25,7 +25,7 @@ require_once('version.php');
require_once('utils/get_absolute_url.php');
if(file_exists("config.php")) {
die("A configuration file already exists. Please delete <i>config.php</i> if you wish to reinstall.\r\n");
die("A configuration file already exists. Please delete <i>config.php</i> if you wish to reinstall.");
}
if (isset($_POST['install'])) {
......@@ -44,7 +44,7 @@ if (isset($_POST['install'])) {
} catch (exception $e) {
var_dump($e);
adodb_backtrace($e->gettrace());
die("Database connection failure\r\n");
die("Database connection failure\n");
}
//Create tables
......@@ -329,10 +329,10 @@ if (isset($_POST['install'])) {
if(!$result) {
$print_config = str_replace("<", "&lt;", $config);
die("Unable to write to file '<i>config.php</i>'. Please create this file and copy the following in to it: <br /><pre>" . $print_config . "</pre>\r\n");
die("Unable to write to file '<i>config.php</i>'. Please create this file and copy the following in to it: <br /><pre>" . $print_config . "</pre>");
}
die("Configuration completed successfully!\r\n");
die("Configuration completed successfully!");
}
?>
......
......@@ -22,10 +22,10 @@ require_once('../../database2.php');
require_once('../../scrobble-utils.php');
if(!isset($_POST['s']) || !isset($_POST['a']) || !isset($_POST['t'])) {
die("FAILED Required POST parameters are not set\r\n");
die("FAILED Required POST parameters are not set\n");
}
if(empty($_POST['s']) || empty($_POST['a']) || empty($_POST['t'])) {
die("FAILED Required POST parameters are empty\r\n");
die("FAILED Required POST parameters are empty\n");
}
$session_id = $_POST['s'];
......@@ -75,6 +75,6 @@ $adodb->Execute("INSERT INTO Now_Playing (sessionid, artist, album, track, expir
. $mbid . ")");
die("OK\r\n");
die("OK\n");
?>
......@@ -34,12 +34,12 @@ function usernameFromSID($session_id)
$res = $mdb2->query("SELECT username FROM Scrobble_Sessions WHERE sessionid = " . $mdb2->quote($session_id, "text")); // get the username from the table
if(PEAR::isError($res)) {
die("FAILED ufs " . $res->getMessage() . "\r\n");
die("FAILED ufs " . $res->getMessage() . "\n");
// die is there is an error, printing the error
}
if(!$res->numRows()) {
die("BADSESSION\r\n");
die("BADSESSION\n");
// the user has no session
}
......@@ -56,14 +56,14 @@ function createArtistIfNew($artist) {
$res = $mdb2->query("SELECT name FROM Artist WHERE name = " . ($artist));
if(PEAR::isError($res)) {
die("FAILED art " . $res->getMessage() . "\r\n");
die("FAILED art " . $res->getMessage() . "\n");
}
if(!$res->numRows()) {
// Artist doesn't exist, so we create them
$res = $mdb2->query("INSERT INTO Artist (name) VALUES (" . ($artist) . ")");
if(PEAR::isError($res)) {
die("FAILED artc " . $res->getMessage() . "\r\n");
die("FAILED artc " . $res->getMessage() . "\n");
}
}
}
......@@ -73,7 +73,7 @@ function createAlbumIfNew($artist, $album) {
$res = $mdb2->query("SELECT name FROM Album WHERE name = " . ($album) . " AND artist_name = " . ($artist));
if(PEAR::isError($res)) {
die("FAILED alb " . $res->getMessage() . "\r\n");
die("FAILED alb " . $res->getMessage() . "\n");
}
if(!$res->numRows()) {
......@@ -92,7 +92,7 @@ function createAlbumIfNew($artist, $album) {
}
if(PEAR::isError($res)) {
die("FAILED albc " . $res->getMessage() . "\r\n");
die("FAILED albc " . $res->getMessage() . "\n");
}
}
}
......@@ -109,7 +109,7 @@ function getTrackCreateIfNew($artist, $album, $track, $mbid) {
$res = $mdb2->query("SELECT id FROM Track WHERE lower(name) = lower(" . ($track) . ") AND lower(artist_name) = lower(" . ($artist) . ") AND album_name IS NULL");
}
if(PEAR::isError($res)) {
die("FAILED trk " . $res->getMessage() . "\r\n");
die("FAILED trk " . $res->getMessage() . "\n");
}
if(!$res->numRows()) {
......@@ -120,7 +120,7 @@ function getTrackCreateIfNew($artist, $album, $track, $mbid) {
. ($album) . ", "
. ($mbid) . ")");
if(PEAR::isError($res)) {
die("FAILED trkc " . $res->getMessage() . "\r\n");
die("FAILED trkc " . $res->getMessage() . "\n");
}
return getTrackCreateIfNew($artist, $album, $track, $mbid);
} else {
......@@ -136,7 +136,7 @@ function getScrobbleTrackCreateIfNew($artist, $album, $track, $mbid, $tid) {
. (($album == 'NULL') ? "IS NULL" : ("= lower(" . ($album) . ")")) . " AND mbid "
. (($mbid == 'NULL') ? "IS NULL" : ("= lower(" . ($mbid) . ")")));
if(PEAR::isError($res)) {
die("FAILED st " . $res->getMessage() . "\r\n");
die("FAILED st " . $res->getMessage() . "\n");
}
if(!$res->numRows()) {
......@@ -151,7 +151,7 @@ function getScrobbleTrackCreateIfNew($artist, $album, $track, $mbid, $tid) {
$msg = $res->getMessage() . " - " . $res->getUserInfo();
reportError($msg, $sql);
die("FAILED stc " . $res->getMessage() . "\r\n");
die("FAILED stc " . $res->getMessage() . "\n");
}
return getScrobbleTrackCreateIfNew($artist, $album, $track, $mbid, $tid);
} else {
......@@ -164,7 +164,7 @@ function scrobbleExists($username, $artist, $track, $time) {
$res = $mdb2->query("SELECT time FROM Scrobbles WHERE username = " . ($username) . " AND artist = " . ($artist) . " AND track = " . ($track) . " AND time = " . ($time));
if(PEAR::isError($res)) {
die("FAILED se " . $res->getMessage() . "\r\n");
die("FAILED se " . $res->getMessage() . "\n");
}
if(!$res->numRows()) {
......@@ -203,7 +203,7 @@ $request=
. "&Keywords=" . $Keywords
. "&ResponseGroup=" . $ResponseGroup;
$aws_xml = simplexml_load_file($request) or die("xml response not loading\r\n");
$aws_xml = simplexml_load_file($request) or die("xml response not loading\n");
$image = $aws_xml->Items->Item->MediumImage->URL;
$URI = $aws_xml->Items->Item->DetailPageURL;
......
......@@ -31,23 +31,23 @@ $supported_protocols = array("1.1");
if(!isset($_GET['p']) || !isset($_GET['u']) || !isset($_GET['c'])) {
die("FAILED\r\n");
die("FAILED\n");
}
$protocol = $_GET['p']; $username = $_GET['u']; $client = $_GET['c'];
if(!in_array($protocol, $supported_protocols)) {
die("FAILED Unsupported protocol version\r\n");
die("FAILED Unsupported protocol version\n");
}
$timestamp = time();
$res = $adodb->GetOne("SELECT password FROM Users WHERE username = ". $adodb->qstr($username));
if(PEAR::isError($res)) {
die("FAILED " . $res->getMessage() . "\r\n");
die("FAILED " . $res->getMessage() . "\n");
}
if(!$res->numRows()) {
die("BADUSER\r\n");
die("BADUSER\n");
}
$password = $res;
$session_id = md5($password . $timestamp);
......@@ -58,12 +58,12 @@ $res = $adodb->Execute("INSERT INTO Scrobble_Sessions(username, sessionid, clien
. $adodb->qstr(time() + 86400) . ")");
if(PEAR::isError($res)) {
die("FAILED " . $res->getMessage() . "\r\n");
die("FAILED " . $res->getMessage() . "\n");
}
echo "UPTODATE\r\n";
echo $timestamp . "\r\n";
echo $submissions_server . "/submissions/1.2/\r\n";
echo "INTERVAL 1\r\n";
echo "UPTODATE\n";
echo $timestamp . "\n";
echo $submissions_server . "/submissions/1.2/\n";
echo "INTERVAL 1\n";
?>
......@@ -27,21 +27,21 @@ $supported_protocols = array("1.2", "1.2.1");
if(!isset($_GET['p']) || !isset($_GET['u']) || !isset($_GET['t']) || !isset($_GET['a']) || !isset($_GET['c'])) {
die("BADAUTH\r\n");
die("BADAUTH\n");
}
$protocol = $_GET['p']; $username = $_GET['u']; $timestamp = $_GET['t']; $auth_token = $_GET['a']; $client = $_GET['c'];
if($client == "import") {
die("FAILED Import scripts are broken\r\n"); // this should be removed or changed to check the version once import.php is fixed
die("FAILED Import scripts are broken\n"); // this should be removed or changed to check the version once import.php is fixed
}
if(!in_array($protocol, $supported_protocols)) {
die("FAILED Unsupported protocol version\r\n");
die("FAILED Unsupported protocol version\n");
}
if(abs($timestamp - time()) > 300) {
die("BADTIME\r\n"); // let's try a 5-minute tolerance
die("BADTIME\n"); // let's try a 5-minute tolerance
}
if(isset($_GET['api_key']) && isset($_GET['sk'])) {
......@@ -51,7 +51,7 @@ if(isset($_GET['api_key']) && isset($_GET['sk'])) {
}
if(!$authed) {
die("BADAUTH\r\n");
die("BADAUTH\n");
}
$session_id = md5($auth_token . time());
......@@ -66,12 +66,12 @@ $res = $adodb->Execute($sql);
if(PEAR::isError($res)) {
$msg = $res->getMessage();
reportError($msg, $sql);
die("FAILED " . $msg . "\r\n");
die("FAILED " . $msg . "\n");
}
echo "OK\r\n";
echo $session_id . "\r\n";
echo $submissions_server . "/nowplaying/1.2/\r\n";
echo $submissions_server . "/submissions/1.2/\r\n";
echo "OK\n";
echo $session_id . "\n";
echo $submissions_server . "/nowplaying/1.2/\n";
echo $submissions_server . "/submissions/1.2/\n";
?>
......@@ -23,14 +23,14 @@ require_once('../../scrobble-utils.php');
if(!isset($_POST['s']) || !isset($_POST['a']) || !isset($_POST['t']) || !isset($_POST['i'])) {
reportError($_POST['u'] . ' POST FAILED', var_dump($_POST));
die("Failed Required POST parameters are not set\r\n");
die("Failed Required POST parameters are not set\n");
}
if(empty($_POST['s']) || empty($_POST['a']) || empty($_POST['t']) || empty($_POST['i'])) {
die("Failed Required POST parameters are empty\r\n");
die("Failed Required POST parameters are empty\n");
}
if(!is_array($_POST['a']) || !is_array($_POST['t']) || !is_array($_POST['i'])) {
die("FAILED Track parameters must be arrays\r\n");
die("FAILED Track parameters must be arrays\n");
}
$session_id = $_POST['s'];
......@@ -46,7 +46,7 @@ for($i = 0; $i < count($_POST['a']); $i++) {
$artist = $adodb->qstr($_POST['a'][$i]);
break;
default:
die("FAILED Bad encoding in artist submission $i\r\n");
die("FAILED Bad encoding in artist submission $i\n");
}
if(isset($_POST['b'][$i]) && !empty($_POST['b'])) {
switch (mb_detect_encoding($_POST['b'][$i])) {
......@@ -55,7 +55,7 @@ for($i = 0; $i < count($_POST['a']); $i++) {
$album = $adodb->qstr($_POST['b'][$i]);
break;
default:
die("FAILED Bad encoding in album submission $i\r\n");
die("FAILED Bad encoding in album submission $i\n");
}
} else {
$album = 'NULL';
......@@ -66,7 +66,7 @@ for($i = 0; $i < count($_POST['a']); $i++) {
$f .= isset($_POST['a'][$i]) ? "A({$_POST['a'][$i]})" : 'a';
$f .= isset($_POST['i'][$i]) ? "I({$_POST['i'][$i]})" : 'i';
die("FAILED Track $i was submitted with empty mandatory field(s): {$f}\r\n");
die("FAILED Track $i was submitted with empty mandatory field(s): {$f}\n");
}
switch (mb_detect_encoding($_POST['t'][$i])) {
......@@ -75,7 +75,7 @@ for($i = 0; $i < count($_POST['a']); $i++) {
$track = $adodb->qstr($_POST['t'][$i]);
break;
default:
die("FAILED Bad encoding in title submission $i\r\n");
die("FAILED Bad encoding in title submission $i\n");
}
if(is_numeric($_POST['i'][$i])) {
$time = (int) $_POST['i'][$i];
......@@ -110,7 +110,7 @@ for($i = 0; $i < count($_POST['a']); $i++) {
}
if(($time - time()) > 300) {
die("FAILED Submitted track has timestamp in the future\r\n"); // let's try a 5-minute tolerance
die("FAILED Submitted track has timestamp in the future\n"); // let's try a 5-minute tolerance
}
createArtistIfNew($artist);
......@@ -153,7 +153,7 @@ for($i = 0; $i < count($_POST['a']); $i++) {
$adodb->FailTrans();
$adodb->CompleteTrans();
reportError($msg, $sql);
die("FAILED " . $msg . "\nError has been reported to site administrators.\r\n");
die("FAILED " . $msg . "\nError has been reported to site administrators.\n");
}
}
......@@ -165,7 +165,7 @@ for($i = 0; $i < count($_POST['a']); $i++) {
$adodb->FailTrans();
$adodb->CompleteTrans();
reportError($msg, $sql);
die("FAILED " . $msg . "\nError has been reported to site administrators.\r\n");
die("FAILED " . $msg . "\nError has been reported to site administrators.\n");
}
// Destroy now_playing since it is almost certainly obsolescent
......@@ -173,6 +173,6 @@ for($i = 0; $i < count($_POST['a']); $i++) {
}
}
die("OK\r\n");
die("OK\n");
?>
......@@ -22,7 +22,7 @@ require_once('../database.php');
require_once('radio-utils.php');
if(!isset($_GET['session']) || !isset($_GET['url'])) {
die("FAILED\r\n");
die("FAILED\n");
}
$session = $_GET['session'];
......@@ -31,7 +31,7 @@ $url = $_GET['url'];
$res = $mdb2->query('SELECT username FROM Radio_Sessions WHERE session = ' . $mdb2->quote($session, 'text'));
if(!$res->numRows()) {
die("BADSESSION\r\n");
die("BADSESSION\n");
}
if(ereg('^(globaltags|artist)/[^:]+$', $url, $regs)) {
......@@ -40,7 +40,7 @@ if(ereg('^(globaltags|artist)/[^:]+$', $url, $regs)) {
$stationname=radio_title_from_url($url);
if($stationname=="FAILED") {
die("FAILED Unavailable station\r\n");
die("FAILED Unavailable station\n");
}
$mdb2->exec('UPDATE Radio_Sessions SET url = ' . $mdb2->quote($url, 'text') . ' WHERE session = ' . $mdb2->quote($session, 'text'));
......
......@@ -21,7 +21,7 @@
require_once('../database.php');
if(!isset($_GET['username']) || !isset($_GET['passwordmd5'])) {
die("BADAUTH\r\n");
die("BADAUTH\n");
}
$username = $_GET['username'];
......@@ -29,7 +29,7 @@ $passmd5 = $_GET['passwordmd5'];
$res = $mdb2->query('SELECT username FROM Users WHERE username = ' . $mdb2->quote($username, 'text') . ' AND password = ' . $mdb2->quote($passmd5, 'text'));
if (!$res->numRows()) {
die("BADAUTH\r\n");
die("BADAUTH\n");
}
$session = md5($passmd5 . time());
......
......@@ -26,7 +26,7 @@ require_once('radio-utils.php');
// These deaths should probably just return an empty playlist
if(!isset($_GET['sk']) || !isset($_GET['desktop'])) {
die("BADSESSION\r\n"); // this should return a blank dummy playlist instead
die("BADSESSION\n"); // this should return a blank dummy playlist instead
}
$session = $_GET['sk'];
......@@ -34,7 +34,7 @@ $session = $_GET['sk'];
$res = $mdb2->query('SELECT url FROM Radio_Sessions WHERE session = ' . $mdb2->quote($session, 'text'));
if(!$res->numRows()) {
die("BADSESSION\r\n"); // this should return a blank dummy playlist instead
die("BADSESSION\n"); // this should return a blank dummy playlist instead
}
$url = $res->fetchOne(0);
......@@ -49,7 +49,7 @@ if(ereg('l(ast|ibre)fm://globaltags/(.*)', $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'));
} else {
die("FAILED\r\n"); // this should return a blank dummy playlist instead
die("FAILED\n"); // this should return a blank dummy playlist instead
}
......
......@@ -26,7 +26,7 @@ if ($_GET['method'] == 'scrobble') {
} elseif ($_GET['method'] == 'nowplaying') {
$url = $submissions_server . '/nowplaying/1.2/';
} else {
die("Invalid proxy method\r\n");
die("Invalid proxy method\n");
}
$session = curl_init($url);
......
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