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

Commit 03a28a84 authored by Mike Sheldon's avatar Mike Sheldon

Make it possible to list service connections and switch scrobble forwarding on and off

parent 76b41d88
......@@ -397,6 +397,20 @@ class User {
}
/**
* Get details of any connections this user has setup to other services.
*
* @return An array of service connection details
*/
function getConnections() {
global $adodb;
$res = $adodb->GetAll('SELECT * FROM Service_Connections WHERE '
. ' userid = ' . $this->uniqueid);
return $res;
}
/**
* Get artists recommended for this yser
*
......
......@@ -33,7 +33,7 @@ if($logged_in == false)
die();
}
if($_GET['token'] && $_GET['webservice_url'] && $logged_in == true) {
if(isset($_GET['token']) && isset($_GET['webservice_url'])) {
// Handle authentication callback from a foreign service
$token = $_GET['token'];
$webservice_url = $_GET['webservice_url'];
......@@ -73,10 +73,19 @@ if($_GET['token'] && $_GET['webservice_url'] && $logged_in == true) {
$smarty->assign('connection_added', true);
}
if(isset($_GET['forward']) && isset($_GET['service'])) {
// Update the user's forwarding preferences
$adodb->Execute('UPDATE Service_Connections SET forward = ' . (int) ($_GET['forward'])
. ' WHERE userid = ' . $this_user->uniqueid
. ' AND webservice_url = ' . $adodb->qstr($_GET['service']));
}
if(isset($lastfm_key)) {
$smarty->assign('lastfm_key', $lastfm_key);
}
$smarty->assign('connections', $this_user->getConnections());
$submenu = user_menu($this_user, 'Edit');
$smarty->assign('submenu', $submenu);
......
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