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

Commit 9068e9c7 authored by tobyink's avatar tobyink

Remove '?>' from config.php; make Free_Scrobbles verses Scrobbles configurable.

parent e3740121
......@@ -315,7 +315,7 @@ if (isset($_POST['install'])) {
$install_path = dirname(__FILE__) . "/";
//Write out the configuration
$config = "<?php\n \$config_version = " . $version .";\n \$connect_string = '" . $connect_string . "';\n \$submissions_server = '" . $submissions_server . "';\n\$install_path = '" . $install_path . "'; ?>";
$config = "<?php\n \$config_version = " . $version .";\n \$connect_string = '" . $connect_string . "';\n \$submissions_server = '" . $submissions_server . "';\n\ $install_path = '" . $install_path . "'; ";
$conf_file = fopen("config.php", "w");
$result = fwrite($conf_file, $config);
......
......@@ -32,7 +32,7 @@ $smarty->assign("name", $artist->name);
$smarty->assign("id", $artist->id);
$smarty->assign("bio_summary", $artist->bio_summary);
$aTagCloud = TagCloud::GenerateTagCloud('Free_Scrobbles', 'artist');
$aTagCloud = TagCloud::GenerateTagCloud(TagCloud::scrobblesTable(), 'artist');
if (!PEAR::isError ($aTagCloud)) {
$smarty->assign('tagcloud', $aTagCloud);
}
......
......@@ -318,7 +318,7 @@ class Group {
function tagCloudData () {
return TagCloud::generateTagCloud(
'Scrobbles INNER JOIN Group_Members ON Scrobbles.username=Group_Members.member',
TagCloud::scrobblesTable('group').' s INNER JOIN Group_Members gm ON s.username=gm.member',
'artist',
40,
$this->name,
......
......@@ -20,6 +20,7 @@
require_once($install_path . '/database2.php');
require_once($install_path . '/data/Server.php');
require_once($install_path . '/config.php'); // Should already be required though.
class TagCloud {
/*
......@@ -51,7 +52,7 @@ class TagCloud {
$adodb->SetFetchMode(ADODB_FETCH_ASSOC);
$res = $adodb->CacheGetAll(7200,$query);
if (!$res) {
echo("ERROR");
echo("ERROR $query");
} else {
foreach($res as $count => &$i) {
$i['size'] = $sizes[(int) ($count/(count($res)/7))];
......@@ -63,5 +64,30 @@ class TagCloud {
return $res;
}
}
/**
* Returns the preferred table to generate scrobble data from.
*
* @param string $area The are where we're displaying scrobble data; one of 'main', 'user', 'group'. Optional: defaults to 'main'.
* @return string Usually 'Scrobbles' or 'Free_Scrobbles'.
* @author tobyink
*/
static function scrobblesTable ($area = 'main')
{
// This array can be set up in config.php
global $scrobblecloud_table;
if (!empty($scrobblecloud_table[$area]))
{
return $scrobblecloud_table[$area];
}
if ($area == 'main')
{
return 'Free_Scrobbles';
}
return 'Scrobbles';
}
}
?>
......@@ -55,7 +55,7 @@ if ($_REQUEST['group']=='new')
else
{
$smarty->assign('newform', true);
$aTagCloud = TagCloud::GenerateTagCloud('Free_Scrobbles', 'artist');
$aTagCloud = TagCloud::GenerateTagCloud(TagCloud::scrobblesTable(), 'artist');
if (!PEAR::isError ($aTagCloud))
{
$smarty->assign('tagcloud', $aTagCloud);
......@@ -143,7 +143,7 @@ if(isset($group->name))
# And display the page.
$smarty->assign('errors', $errors);
$smarty->assign('newform', false);
$aTagCloud = TagCloud::GenerateTagCloud('Free_Scrobbles', 'artist');
$aUserTagCloud = $group->tagCloudData();
if (!PEAR::isError ($aTagCloud))
{
$smarty->assign('tagcloud', $aTagCloud);
......
......@@ -27,7 +27,7 @@ require_once('data/Server.php');
require_once('data/TagCloud.php');
// This should be contextual based on the mode= parameter?
$aTagCloud = TagCloud::GenerateTagCloud('Free_Scrobbles', 'artist');
$aTagCloud = TagCloud::GenerateTagCloud(TagCloud::scrobblesTable(), 'artist');
if (!PEAR::isError ($aTagCloud)) {
$smarty->assign('tagcloud', $aTagCloud);
}
......
......@@ -36,7 +36,7 @@ if (! $_GET['group'])
'href' => $base_url.'/rdf.php?fmt=xml&page='.htmlentities($_SERVER['REQUEST_URI'])
)
));
$aTagCloud = TagCloud::GenerateTagCloud('Free_Scrobbles', 'artist');
$aTagCloud = TagCloud::GenerateTagCloud(TagCloud::scrobblesTable(), 'artist');
if (!PEAR::isError ($aTagCloud))
{
$smarty->assign('tagcloud', $aTagCloud);
......
......@@ -25,7 +25,7 @@ require_once('data/sanitize.php');
require_once('data/Server.php');
require_once('data/TagCloud.php');
$aTagCloud = TagCloud::GenerateTagCloud('Free_Scrobbles', 'artist');
$aTagCloud = TagCloud::GenerateTagCloud(TagCloud::scrobblesTable(), 'artist');
if (!PEAR::isError ($aTagCloud)) {
$smarty->assign('tagcloud', $aTagCloud);
}
......
......@@ -52,7 +52,7 @@ if (isset($_POST['install'])) {
$submissions_server = $_POST['submissions_server'];
//Write out the configuration
$config = "<?php\n \$config_version = " . $version .";\n \$connect_string = '" . $connect_string . "';\n \$default_theme = '" . $default_theme . "';\n \$base_url = '" . $base_url . "';\n \$submissions_server = '" . $submissions_server . "';\n \$install_path = '" . $install_path . "'; ?>";
$config = "<?php\n \$config_version = " . $version .";\n \$connect_string = '" . $connect_string . "';\n \$default_theme = '" . $default_theme . "';\n \$base_url = '" . $base_url . "';\n \$submissions_server = '" . $submissions_server . "';\n \$install_path = '" . $install_path . "'; ";
$conf_file = fopen("config.php", "w");
$result = fwrite($conf_file, $config);
......
......@@ -23,7 +23,7 @@ require_once('database.php');
require_once('templating.php');
require_once('data/TagCloud.php');
$aTagCloud = TagCloud::GenerateTagCloud('Scrobbles', 'artist');
$aTagCloud = TagCloud::GenerateTagCloud(TagCloud::scrobblesTable(), 'artist');
if (!PEAR::isError ($aTagCloud)) {
$smarty->assign('tagcloud', $aTagCloud);
}
......
......@@ -33,7 +33,7 @@ $smarty->assign("albumurl", Server::getAlbumURL($track->artist_name, $track->alb
$smarty->assign("artisturl", Server::getArtistURL($track->artist_name));
// no idea how this would be track-relevant
$aTagCloud = TagCloud::GenerateTagCloud('Free_Scrobbles', 'artist');
$aTagCloud = TagCloud::GenerateTagCloud(TagCloud::scrobblesTable(), 'artist');
if (!PEAR::isError ($aTagCloud)) {
$smarty->assign('tagcloud', $aTagCloud);
}
......
......@@ -170,7 +170,7 @@ if(isset($this_user->name))
}
# And display the page.
$aTagCloud = TagCloud::GenerateTagCloud('Free_Scrobbles', 'artist');
$aTagCloud = TagCloud::GenerateTagCloud(TagCloud::scrobblesTable('user'), 'artist', 40, $this_user->name);
if (!PEAR::isError ($aTagCloud))
{
$smarty->assign('tagcloud', $aTagCloud);
......
......@@ -39,7 +39,7 @@ $user = new User($_GET['user']);
if(isset($user->name)) {
$smarty->assign('geo', Server::getLocationDetails($user->location_uri));
$aUserTagCloud = TagCloud::GenerateTagCloud('Scrobbles', 'artist', 40, $user->name);
$aUserTagCloud = TagCloud::GenerateTagCloud(TagCloud::scrobblesTable('user'), 'artist', 40, $user->name);
if (!PEAR::isError ($aUserTagCloud)) {
$smarty->assign('user_tagcloud',$aUserTagCloud);
}
......
......@@ -66,7 +66,7 @@ foreach ($index as $subject => $data)
}
}
$aUserTagCloud = TagCloud::GenerateTagCloud('Scrobbles', 'artist', 40, $user->name);
$aUserTagCloud = TagCloud::GenerateTagCloud(TagCloud::scrobblesTable('user'), 'artist', 40, $user->name);
if (!PEAR::isError ($aUserTagCloud)) {
$smarty->assign('user_tagcloud',$aUserTagCloud);
}
......
......@@ -45,7 +45,7 @@ if(isset($user->name)) {
if (!PEAR::isError ($aUserNowPlaying)) {
$smarty->assign('nowplaying', $aUserNowPlaying);
}
$aUserTagCloud = TagCloud::GenerateTagCloud('Scrobbles', 'artist', 40, $user->name);
$aUserTagCloud = TagCloud::GenerateTagCloud(TagCloud::scrobblesTable('user'), 'artist', 40, $user->name);
if (!PEAR::isError ($aUserTagCloud)) {
$smarty->assign('user_tagcloud',$aUserTagCloud);
}
......
......@@ -46,7 +46,7 @@ if(isset($user->name)) {
if (!PEAR::isError ($aUserScrobbles)) {
$smarty->assign('scrobbles', $aUserScrobbles);
}
$aUserTagCloud = TagCloud::GenerateTagCloud('Scrobbles', 'artist', 40, $user->name);
$aUserTagCloud = TagCloud::GenerateTagCloud(TagCloud::scrobblesTable('user'), 'artist', 40, $user->name);
if (!PEAR::isError ($aUserTagCloud)) {
$smarty->assign('user_tagcloud',$aUserTagCloud);
}
......
......@@ -36,7 +36,7 @@ $user = new User($_GET['user']);
if(isset($user->name)) {
# $aUserTagCloud = TagCloud::GenerateTagCloud('Scrobbles', 'artist', 40, $user->name);
# $aUserTagCloud = TagCloud::GenerateTagCloud(TagCloud::scrobblesTable('user'), 'artist', 40, $user->name);
# if (!PEAR::isError ($aUserTagCloud)) {
# $smarty->assign('user_tagcloud',$aUserTagCloud);
# }
......
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