Commit 8f255d9f authored by Jonas Haraldsson's avatar Jonas Haraldsson

Handshake now working

Added 1.x handshake check to nixtape/index.php
Deleted 1.x/database.php
Deleted 1.x/index.php
parent f515e268
<?php
/* GNUkebox -- a free software server for recording your listening habits
Copyright (C) 2009 Free Software Foundation, Inc
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
if (!file_exists(dirname(__FILE__) . '/config.php')) {
die('Please run the <a href=\'install.php\'>Install</a> script to configure your installation');
}
require_once('config.php');
require_once('adodb/adodb-exceptions.inc.php');
require_once('adodb/adodb.inc.php');
try {
$adodb =& NewADOConnection($connect_string);
} catch (Exception $e) {
die("Unable to connect to database");
}
// To keep functionality with existing code
function reportError($msg, $sql) {
global $adodb;
$adodb->Execute('INSERT INTO Error(msg, data, time) VALUES('
. $adodb->qstr($msg) . ', '
. $adodb->qstr($sql) . ', '
. time() . ')');
}
?>
<?php
/* GNUkebox -- a free software server for recording your listening habits
Copyright (C) 2009, 2011 Free Software Foundation, Inc
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
require_once('database.php');
require_once('version.php');
// Display things?
$displaythings = true;
if (!isset($config_version) || $config_version != $version) {
die('Configuration file is out of date. Please delete it (and associated database) and <a href="install.php">reinstall</a>.'); //TODO: Upgrade script for release versions
}
if (isset($_REQUEST['hs']) && isset($_REQUEST['p'])) {
if (substr($_REQUEST['p'], 0, 3) == '1.2') {
require_once('submissions/1.2/handshake.php');
} else if (substr($_REQUEST['p'], 0, 3) == '1.1') {
require_once('submissions/1.1/handshake.php');
}
} else {
//If we're not handshaking then just display some nice stats
if ($displaythings) {
require_once('help.php');
} else {
echo '<h1>GNUkebox!</h1><p>Please configure your system for ' . $_SERVER['SERVER_NAME'] . '</p>';
}
}
......@@ -24,7 +24,7 @@
// force a 1.1 client to give us a session key that can be used by the 1.2 protocol handler, so we only handle handshakes for
// 1.1 then pass all submissions off to the 1.2 handler.
require_once('auth-utils.php');
require_once('1.x/auth-utils.php');
require_once('config.php');
require_once('temp-utils.php');
......@@ -66,5 +66,5 @@ $res = $adodb->Execute('INSERT INTO Scrobble_Sessions(userid, sessionid, client,
echo "UPTODATE\n";
echo $timestamp . "\n";
echo $submissions_server . "/submissions/1.2/\n";
echo $base_url . "/1.x/submissions/1.2/\n";
echo "INTERVAL 1\n";
......@@ -20,7 +20,7 @@
// Implements the submissions handshake protocol as detailed at: http://www.last.fm/api/submissions
require_once('auth-utils.php');
require_once('1.x/auth-utils.php');
require_once('config.php');
require_once('temp-utils.php');
......@@ -76,5 +76,5 @@ try {
echo "OK\n";
echo $session_id . "\n";
echo $submissions_server . "/nowplaying/1.2/\n";
echo $submissions_server . "/submissions/1.2/\n";
echo $base_url . "/1.x/nowplaying/1.2/\n";
echo $base_url . "/1.x/submissions/1.2/\n";
......@@ -20,18 +20,27 @@
*/
require_once('database.php');
require_once('templating.php');
require_once('data/sanitize.php');
require_once('data/Server.php');
require_once('data/TagCloud.php');
try {
$aTagCloud = TagCloud::GenerateTagCloud('loved', 'artist');
$smarty->assign('tagcloud', $aTagCloud);
} catch(Exception $e) {
// Installation doesn't have any loved tracks yet
}
$smarty->assign('headerfile', 'welcome-header.tpl');
$smarty->assign('welcome', true);
$smarty->display('welcome.tpl');
if (isset($_REQUEST['hs']) && isset($_REQUEST['p'])) {
if (substr($_REQUEST['p'], 0, 3) == '1.2') {
require_once('1.x/submissions/1.2/handshake.php');
} else if (substr($_REQUEST['p'], 0, 3) == '1.1') {
require_once('1.x/submissions/1.1/handshake.php');
}
} else {
//If we're not handshaking we display the nixtape start page
require_once('templating.php');
require_once('data/sanitize.php');
require_once('data/Server.php');
require_once('data/TagCloud.php');
try {
$aTagCloud = TagCloud::GenerateTagCloud('loved', 'artist');
$smarty->assign('tagcloud', $aTagCloud);
} catch(Exception $e) {
// Installation doesn't have any loved tracks yet
}
$smarty->assign('headerfile', 'welcome-header.tpl');
$smarty->assign('welcome', true);
$smarty->display('welcome.tpl');
}
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