[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Librefm-commits] [1752] partial merge of gnukebox/ and nixtape/ from tr
From: |
Clint Adams |
Subject: |
[Librefm-commits] [1752] partial merge of gnukebox/ and nixtape/ from trunk |
Date: |
Sat, 23 May 2009 21:27:10 +0000 |
Revision: 1752
http://svn.sv.gnu.org/viewvc/?view=rev&root=librefm&revision=1752
Author: clint
Date: 2009-05-23 21:27:10 +0000 (Sat, 23 May 2009)
Log Message:
-----------
partial merge of gnukebox/ and nixtape/ from trunk
Modified Paths:
--------------
branches/stable/gnukebox/install.php
branches/stable/gnukebox/scrobble-utils.php
branches/stable/gnukebox/submissions/1.1/handshake.php
branches/stable/gnukebox/submissions/1.2/handshake.php
branches/stable/nixtape/2.0/index.php
branches/stable/nixtape/album.php
branches/stable/nixtape/artist.php
branches/stable/nixtape/auth.php
branches/stable/nixtape/data/Album.php
branches/stable/nixtape/data/User.php
branches/stable/nixtape/delete-profile.php
branches/stable/nixtape/login.php
branches/stable/nixtape/radio/xspf.php
branches/stable/nixtape/reset.php
branches/stable/nixtape/templating.php
branches/stable/nixtape/themes/librefm/alpha.css
branches/stable/nixtape/themes/librefm/templates/album.tpl
branches/stable/nixtape/themes/librefm/templates/group.tpl
branches/stable/nixtape/themes/librefm/templates/menu.tpl
branches/stable/nixtape/themes/librefm/templates/player.tpl
branches/stable/nixtape/themes/librefm/templates/radio_xspf.tpl
branches/stable/nixtape/themes/librefm/templates/register.tpl
branches/stable/nixtape/themes/librefm/templates/reset.tpl
branches/stable/nixtape/themes/librefm/templates/track.tpl
branches/stable/nixtape/themes/librefm/templates/user-edit.tpl
branches/stable/nixtape/themes/librefm/templates/user-recent-tracks.tpl
branches/stable/nixtape/themes/librefm/templates/user-stats.tpl
branches/stable/nixtape/track.php
branches/stable/nixtape/user-edit.php
branches/stable/nixtape/user-stats.php
Added Paths:
-----------
branches/stable/gnukebox/temp-utils.php
branches/stable/nixtape/themes/librefm/templates/radio_oldxspf.tpl
Modified: branches/stable/gnukebox/install.php
===================================================================
--- branches/stable/gnukebox/install.php 2009-05-23 21:13:42 UTC (rev
1751)
+++ branches/stable/gnukebox/install.php 2009-05-23 21:27:10 UTC (rev
1752)
@@ -74,6 +74,7 @@
created INTEGER NOT NULL,
modified INTEGER,
userlevel INTEGER DEFAULT 0,
+ anticommercial INTEGER DEFAULT 0,
webid_uri VARCHAR(255),
avatar_uri VARCHAR(255),
active INTEGER DEFAULT 1,
@@ -182,7 +183,7 @@
stid INTEGER)");
$adodb->Execute("CREATE TABLE Scrobble_Sessions(
- username VARCHAR(64) REFERENCES Users(username),
+ userid INTEGER REFERENCES Users(uniqueid),
sessionid VARCHAR(32) PRIMARY KEY,
client CHAR(3),
expires INTEGER)");
Modified: branches/stable/gnukebox/scrobble-utils.php
===================================================================
--- branches/stable/gnukebox/scrobble-utils.php 2009-05-23 21:13:42 UTC (rev
1751)
+++ branches/stable/gnukebox/scrobble-utils.php 2009-05-23 21:27:10 UTC (rev
1752)
@@ -20,6 +20,7 @@
*/
require_once('database.php'); // include the database connection string
+require_once('temp-utils.php');
function usernameFromSID($session_id)
{
@@ -32,7 +33,7 @@
$adodb->Execute('DELETE FROM Scrobble_Sessions WHERE expires < ' .
time());
try {
- $res = $adodb->GetOne('SELECT username FROM Scrobble_Sessions
WHERE sessionid = ' . $adodb->qstr($session_id)); // get the username from the
table
+ $res = $adodb->GetOne('SELECT user FROM Scrobble_Sessions WHERE
sessionid = ' . $adodb->qstr($session_id)); // get the username from the table
}
catch (exception $e) {
die('FAILED ufs ' . $e->getMessage() . '\n');
@@ -45,7 +46,8 @@
// the user has no session
}
- return $res;
+ $username = uniqueid_to_username($res);
+ return $username;
// return the first user
}
@@ -229,16 +231,17 @@
}
function validateMBID ($input) {
-if(isset($input)) {
- $input = strtolower(rtrim($input));
-
if(preg_match('/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/',
$input)) {
- return $input;
+ if(isset($input)) {
+ $input = strtolower(rtrim($input));
+
if(preg_match('/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/',
$input)) {
+ return $input;
+ } else {
+ return null;
+ }
} else {
return null;
}
-} else {
- return null;
+
}
-}
?>
Modified: branches/stable/gnukebox/submissions/1.1/handshake.php
===================================================================
--- branches/stable/gnukebox/submissions/1.1/handshake.php 2009-05-23
21:13:42 UTC (rev 1751)
+++ branches/stable/gnukebox/submissions/1.1/handshake.php 2009-05-23
21:27:10 UTC (rev 1752)
@@ -42,20 +42,22 @@
$timestamp = time();
+$adodb->SetFetchMode(ADODB_FETCH_ASSOC);
try {
- $res = $adodb->GetOne("SELECT password FROM Users WHERE username = ".
$adodb->qstr($username));
+ $row = $adodb->GetRow('SELECT uniqueid,password FROM Users WHERE
username = '. $adodb->qstr($username));
}
catch (exception $e) {
die("FAILED " . $e->getMessage() . "\n");
}
-if(!$res) {
+if(!$row) {
die("BADUSER\n");
}
-$password = $res;
+$password = $row['password'];
+$uniqueid = $row['uniqueid'];
$session_id = md5($password . $timestamp);
try {
-$res = $adodb->Execute("INSERT INTO Scrobble_Sessions(username, sessionid,
client, expires) VALUES ("
- . $adodb->qstr($username, "text") . ","
+$res = $adodb->Execute("INSERT INTO Scrobble_Sessions(userid, sessionid,
client, expires) VALUES ("
+ . ($uniqueid) . ","
. $adodb->qstr($session_id, "text") . ","
. $adodb->qstr($client, "text") . ","
. $adodb->qstr(time() + 86400) . ")");
Modified: branches/stable/gnukebox/submissions/1.2/handshake.php
===================================================================
--- branches/stable/gnukebox/submissions/1.2/handshake.php 2009-05-23
21:13:42 UTC (rev 1751)
+++ branches/stable/gnukebox/submissions/1.2/handshake.php 2009-05-23
21:27:10 UTC (rev 1752)
@@ -54,9 +54,10 @@
die("BADAUTH\n");
}
+$uniqueid = username_to_uniqueid($username);
$session_id = md5($auth_token . time());
-$sql = "INSERT INTO Scrobble_Sessions(username, sessionid, client, expires)
VALUES ("
- . $adodb->qstr($username) . ","
+$sql = "INSERT INTO Scrobble_Sessions(userid, sessionid, client, expires)
VALUES ("
+ . ($uniqueid) . ","
. $adodb->qstr($session_id) . ","
. $adodb->qstr($client) . ","
. (time() + 86400) . ")";
Copied: branches/stable/gnukebox/temp-utils.php (from rev 1739,
branches/stable/nixtape/auth.php)
===================================================================
--- branches/stable/gnukebox/temp-utils.php (rev 0)
+++ branches/stable/gnukebox/temp-utils.php 2009-05-23 21:27:10 UTC (rev
1752)
@@ -0,0 +1,52 @@
+<?php
+
+/* Libre.fm -- a free network service for sharing your music 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/>.
+
+*/
+
+require_once('database.php'); // include the database connection string
+
+// these functions should be short-lived while things go through a transition
+
+function username_to_uniqueid($username) {
+ global $adodb;
+
+ $adodb->SetFetchMode(ADODB_FETCH_ASSOC);
+ try {
+ $uniqueid = $adodb->GetOne('SELECT uniqueid from Users where
lower(username) = lower('.$adodb->qstr($username).')');
+ } catch (exception $e) {
+ return null;
+ }
+
+ return $uniqueid;
+}
+
+function uniqueid_to_username($uniqueid) {
+ global $adodb;
+
+ $adodb->SetFetchMode(ADODB_FETCH_ASSOC);
+ try {
+ $username = $adodb->GetOne('SELECT username from Users where
uniqueid = '.($uniqueid));
+ } catch (exception $e) {
+ return null;
+ }
+
+ return $username;
+}
+
+?>
Modified: branches/stable/nixtape/2.0/index.php
===================================================================
--- branches/stable/nixtape/2.0/index.php 2009-05-23 21:13:42 UTC (rev
1751)
+++ branches/stable/nixtape/2.0/index.php 2009-05-23 21:27:10 UTC (rev
1752)
@@ -37,6 +37,10 @@
define('LFM_SUBSCRIPTION_ERROR',12);
define('LFM_INVALID_SIGNATURE', 13);
define('LFM_SUBSCRIPTION_REQD', 18);
+define('LFM_NOT_ENOUGH_CONTENT', 20);
+define('LFM_NOT_ENOUGH_MEMBERS', 21);
+define('LFM_NOT_ENOUGH_FANS', 22);
+define('LFM_NOT_ENOUGH_NEIGHBORS', 23);
# Error descriptions as per API documentation
$error_text = array(
@@ -53,6 +57,10 @@
LFM_SUBSCRIPTION_ERROR => 'Subscription Error - The user needs
to be subscribed in order to do that',
LFM_INVALID_SIGNATURE => 'Invalid method signature supplied',
LFM_SUBSCRIPTION_REQD => 'This user has no free radio plays
left. Subscription required.'
+ LFM_NOT_ENOUGH_CONTENT => 'There is not enough content to play
this station'
+ LFM_NOT_ENOUGH_MEMBERS => 'This group does not have enough
members for radio'
+ LFM_NOT_ENOUGH_FANS => 'This artist does not have enough
fans for radio'
+ LFM_NOT_ENOUGH_NEIGHBORS => 'Thare are not enough neighbors for
radio'
);
# Resolves method= parameters to handler functions
@@ -63,7 +71,9 @@
'artist.getinfo' => method_artist_getinfo,
'artist.gettoptracks' => method_artist_gettoptracks,
'user.getinfo' => method_user_getinfo,
- 'user.gettoptracks' => method_user_gettoptracks
+ 'user.gettoptracks' => method_user_gettoptracks,
+ 'radio.tune' => method_radio_tune,
+ 'radio.getPlaylist' => method_radio_getPlaylist,
);
function method_user_gettoptracks() {
@@ -217,6 +227,80 @@
print("</lfm>");
}
+function method_radio_tune() {
+ global $adodb;
+
+ if (!isset($_GET['api_sig']) || !valid_api_sig($_GET['api_sig']))
+ report_failure(LFM_INVALID_SIGNATURE);
+
+ if (!isset($_GET['station']))
+ report_failure(LFM_INVALID_PARAMS);
+
+ if (!isset($_GET['api_key']))
+ report_failure(LFM_INVALID_PARAMS);
+
+ if (!isset($_GET['sk']))
+ report_failure(LFM_INVALID_PARAMS);
+
+ try {
+ $username = $adodb->GetOne('SELECT username FROM Auth WHERE '
+ . 'token = ' . $adodb->qstr($_GET['token']) . ' AND '
+ . 'username IS NOT NULL AND sk = '.$adodb->qstr($_GET['sk']));
+ }
+ catch (exception $e) {
+ report_failure(LFM_SERVICE_OFFLINE);
+ }
+ if (!$username) {
+ report_failure(LFM_INVALID_TOKEN);
+ }
+
+/*
+ * Here we should tune the station. The immediate problem is that
+ * without radio handshake, the user will not necessarily have a
+ * session in Radio_Sessions.
+ *
+ * After that's solved, we should either set $stationtype,
+ * $stationname, $stationurl, or report_failure.
+ */
+ report_failure(LFM_SUBSCRIPTION_REQD);
+
+ print("<lfm status=\"ok\">\n");
+ print(" <station>\n");
+ print(" <type>{$stationtype}</type>\n");
+ print(" <name>{$stationname}</name>\n");
+ print(" <url>{$stationurl}</url>\n");
+ print(" <supportsdiscovery>0</supportsdiscovery>\n");
+ print(" </station>\n");
+ print("</lfm>");
+}
+
+function method_radio_getPlaylist() {
+ global $adodb;
+
+ if (!isset($_GET['api_sig']) || !valid_api_sig($_GET['api_sig']))
+ report_failure(LFM_INVALID_SIGNATURE);
+
+ if (!isset($_GET['api_key']))
+ report_failure(LFM_INVALID_PARAMS);
+
+ if (!isset($_GET['sk']))
+ report_failure(LFM_INVALID_PARAMS);
+
+/*
+ * Here we should get the station based on the session key. If
+ * no station is tuned for that key, we should default to something
+ * reasonable.
+ *
+ * Then we should return a playlist in a format not quite identical
+ * to the one spit out
+ * by xspf.php.
+ */
+
+ die("Unimplemented.\n");
+
+}
+
+
function valid_api_key($key) {
return strlen($key) == 32;
}
Modified: branches/stable/nixtape/album.php
===================================================================
--- branches/stable/nixtape/album.php 2009-05-23 21:13:42 UTC (rev 1751)
+++ branches/stable/nixtape/album.php 2009-05-23 21:27:10 UTC (rev 1752)
@@ -24,7 +24,7 @@
require_once('templating.php');
require_once('data/Album.php');
-$album = new Album(urldecode($_GET['album']), urldecode($_GET['artist']));
+$album = new Album($_GET['album'], $_GET['artist']);
$artist = new Artist($album->artist_name);
$smarty->assign('name', $album->name);
Modified: branches/stable/nixtape/artist.php
===================================================================
--- branches/stable/nixtape/artist.php 2009-05-23 21:13:42 UTC (rev 1751)
+++ branches/stable/nixtape/artist.php 2009-05-23 21:27:10 UTC (rev 1752)
@@ -26,7 +26,13 @@
require_once('data/Server.php');
require_once('data/TagCloud.php');
-$artist = new Artist(urldecode($_GET['artist']));
+try {
+ $artist = new Artist($_GET['artist']);
+} catch (exception $e) {
+ $smarty->assign('error', 'Artist not found.');
+ $smarty->assign('details', 'The artist '.($_GET['artist']).' was not
found in the database.');
+ $smarty->display("error.tpl");
+}
$smarty->assign('name', $artist->name);
$smarty->assign('id', $artist->id);
@@ -53,5 +59,4 @@
$smarty->display("artist.tpl");
-
?>
Modified: branches/stable/nixtape/auth.php
===================================================================
--- branches/stable/nixtape/auth.php 2009-05-23 21:13:42 UTC (rev 1751)
+++ branches/stable/nixtape/auth.php 2009-05-23 21:27:10 UTC (rev 1752)
@@ -21,12 +21,14 @@
require_once('database.php');
require_once('data/User.php');
+require_once('../turtle/temp-utils.php'); // this is extremely dodgy and
shameful
+
session_start();
if(isset($_COOKIE['session_id'])) {
$err = 0;
$adodb->SetFetchMode(ADODB_FETCH_ASSOC);
try {
- $row = $adodb->GetRow('SELECT username FROM Scrobble_Sessions
WHERE '
+ $row = $adodb->GetRow('SELECT userid FROM Scrobble_Sessions
WHERE '
. 'sessionid = ' .
$adodb->qstr($_COOKIE['session_id'])
. ' AND expires > ' . (int)(time()));
}
@@ -40,7 +42,8 @@
session_destroy();
} else {
$logged_in = true;
- $this_user = new User($row['username']);
+ $username = uniqueid_to_username($row['userid']);
+ $this_user = new User($username);
}
}
?>
Modified: branches/stable/nixtape/data/Album.php
===================================================================
--- branches/stable/nixtape/data/Album.php 2009-05-23 21:13:42 UTC (rev
1751)
+++ branches/stable/nixtape/data/Album.php 2009-05-23 21:27:10 UTC (rev
1752)
@@ -122,11 +122,140 @@
return Server::getAlbumURL($this->artist_name, $this->name);
}
+ /*
+ * Return Album Art URL from Wikipedia
+ * @param string Album
+ * @param string Artist
+ * @param bool Save info to Album table.
+ * @param string Wikipedia API URL
+ * @return an object with the url and usage_url properties
+ */
+ function WikipediaAlbumArt ($album_name, $artist_name, $save = false,
$api_url = 'http://en.wikipedia.org/w/api.php') {
+ global $adodb;
+ /*
+ * Search query string
+ */
+ $album_name = mb_convert_case($album_name, 'UTF-8');
+ $artist_name = mb_convert_case($artist_name, 'UTF-8');
+ $get_params = array(
+ 'action' => 'query',
+ 'format' => 'php',
+ 'redirects' => true,
+ 'list' => 'search',
+ 'srsearch' => "$album_name $artist_name album",
+ 'srlimit' => 10
+ );
+
+ try {
+ if (is_null($album_name)) throw new Exception('No album name
provided.');
+
+ $search_url = $api_url . '?' . http_build_query($get_params);
+
+ $open = fopen($search_url, 'r');
+
+ if ($open == false) throw new Exception('Can\'t open Search URL');
+
+ $search_results = unserialize(stream_get_contents($open));
+ fclose($open);
+
+ if (!isset($search_results['query']['search']) ||
count($search_results['query']['search']) == 0)
+ return false;
+
+ $results = array();
+
+ foreach ($search_results['query']['search'] as $id => $page) {
+ switch ($page['title']) {
+ case ($album_name):
+ $weight = 0.5;
+ break;
+ case ("$album_name (album)"):
+ $weight = 0.75;
+ break;
+ case ("$album_name ($artist_name album)"):
+ $weight = 1;
+ break;
+ default:
+ $weight = 0;
+ }
+
+ if ($weight > 0)
+ $results[$page['title']] = $weight;
+ }
+
+ if (count($results) > 0) {
+ # order by weight
+ # highest gets on bottom
+ asort($results);
+ end($results);
+
+ $possible_cover = key($results);
+
+ # Cover search query string
+ $cover_params = array(
+ 'action' => 'query',
+ 'format' => 'php',
+ 'redirects' => true,
+ 'generator' => 'images',
+ 'titles' => $possible_cover,
+ 'prop' => 'imageinfo',
+ 'iiprop' => 'url'
+ );
+
+ $cover_search_url = $api_url . '?' .
http_build_query($cover_params);
+ $open_cover_url = fopen($cover_search_url, 'r');
+
+ if ($open_cover_url == false) throw new Exception ('Can\'t
open Cover Search URL');
+ $cover_search_results =
unserialize(stream_get_contents($open_cover_url));
+ fclose($open_cover_url);
+
+ if (!isset($cover_search_results['query']['pages']) ||
count($cover_search_results['query']['pages']) == 0)
+ return false;
+
+ foreach ($cover_search_results['query']['pages'] as $image_id
=> $image) {
+ # Wikipedia covers are mostly JPEG images.
+ # Gets the first image (hard guess!)
+ if (preg_match('/\.jpg$/i', $image['title']) == 1) {
+ $cover = $image['imageinfo'][0];
+ break;
+ }
+ }
+
+ /*
+ * Save the info if $save = true
+ */
+ if ($save) {
+ $adodb->SetFetchMode(ADODB_FETCH_ASSOC);
+ $album = $adodb->qstr($album_name);
+ $artist = $adodb->qstr($artist_name);
+ $license = $adodb->qstr($cover['descriptionurl']);
+ $image = $adodb->qstr($cover['url']);
+
+ $sql = ('UPDATE Album SET image = '
+ . ($image) . ', '
+ . ' artwork_license = '
+ . ($license) . ' WHERE artist_name = '. ($artist)
+ . ' AND name = ' . ($album));
+
+ $res = $adodb->Execute($sql);
+ }
+
+ return $cover['url'];
+
+ } else {
+ return false;
+ }
+
+
+ } catch (exception $e) {
+ reportError($e->getMessage());
+ }
+
+ return $album_art_url;
+ }
}
-
function go_get_album_art($artist, $album){
global $adodb;
$adodb->SetFetchMode(ADODB_FETCH_ASSOC);
Modified: branches/stable/nixtape/data/User.php
===================================================================
--- branches/stable/nixtape/data/User.php 2009-05-23 21:13:42 UTC (rev
1751)
+++ branches/stable/nixtape/data/User.php 2009-05-23 21:27:10 UTC (rev
1752)
@@ -34,7 +34,7 @@
public $name, $email, $fullname, $bio, $location, $homepage, $error,
$userlevel;
public $id, $acctid, $avatar_uri, $location_uri, $webid_uri,
$laconica_profile, $journal_rss;
- public $password, $has_identica, $created, $modified, $uniqueid;
+ public $password, $has_identica, $created, $modified, $uniqueid,
$anticommercial;
/**
* User constructor
@@ -78,6 +78,7 @@
$this->created = $row['created'];
$this->modified = $row['modified'];
$this->uniqueid = $row['uniqueid'];
+ $this->anticommercial = $row['anticommercial'];
$this->has_identica =
preg_match('#^http://identi\.ca/#i', $this->laconica_profile);
@@ -124,6 +125,7 @@
. 'avatar_uri=%s, '
. 'laconica_profile=%s, '
. 'journal_rss=%s, '
+ . 'anticommercial=%d, '
. 'modified=%d '
. 'WHERE username=%s'
, $adodb->qstr($this->email)
@@ -138,6 +140,7 @@
, $adodb->qstr($this->avatar_uri)
, $adodb->qstr($this->laconica_profile)
, $adodb->qstr($this->journal_rss)
+ , (int)($this->anticommercial)
, time()
, $adodb->qstr($this->name));
@@ -148,6 +151,9 @@
exit;
}
+ $query = 'SELECT * FROM Users WHERE lower(username) = ' .
$adodb->qstr(strtolower($this->name));
+ $adodb->CacheFlush($query);
+
return 1;
}
@@ -197,8 +203,8 @@
function getScrobbleSession() {
global $adodb;
$session_id = md5(mt_rand() . time());
- $sql = 'INSERT INTO Scrobble_Sessions(username, sessionid,
client, expires) VALUES ('
- . $adodb->qstr($this->name) . ','
+ $sql = 'INSERT INTO Scrobble_Sessions(userid, sessionid,
client, expires) VALUES ('
+ . ($this->uniqueid) . ','
. $adodb->qstr($session_id) . ','
. '\'lfm\','
. (time() + 86400) . ')';
@@ -224,10 +230,14 @@
*
* @return user's top 20 tracks
*/
- function getTopTracks($number=20) {
+ function getTopTracks($number=20, $since=null) {
global $adodb;
- $query = 'SELECT COUNT(track) as c, artist, album, track FROM
Scrobbles WHERE username = '.$adodb->qstr($this->name).' GROUP BY
artist,album,track ORDER BY c DESC LIMIT ' . ($number);
+ if ($since) {
+ $query = 'SELECT COUNT(track) as c, artist, album,
track FROM Scrobbles WHERE username = '.$adodb->qstr($this->name).' AND time >
'.(int)($since).' GROUP BY artist,album,track ORDER BY c DESC LIMIT ' .
($number);
+ } else {
+ $query = 'SELECT COUNT(track) as c, artist, album,
track FROM Scrobbles WHERE username = '.$adodb->qstr($this->name).' GROUP BY
artist,album,track ORDER BY c DESC LIMIT ' . ($number);
+ }
$adodb->SetFetchMode(ADODB_FETCH_ASSOC);
$data = $adodb->CacheGetAll(7200,$query);
if (!$data) {
@@ -236,24 +246,39 @@
$maxcount = 0;
- foreach($data as &$i) {
- $row = sanitize($i);
- $row['artisturl'] = Server::getArtistURL($row['artist']);
- $row['trackurl'] =
Server::getTrackURL($row['artist'],$row['album'],$row['track']);
- if ((int)$row['c'] > $maxcount) {
- $maxcount = (int)$row['c'];
- }
- $result[] = $row;
- }
+ foreach($data as &$i) {
+ $row = sanitize($i);
+ $row['artisturl'] =
Server::getArtistURL($row['artist']);
+ $row['trackurl'] =
Server::getTrackURL($row['artist'],$row['album'],$row['track']);
+ if ((int)$row['c'] > $maxcount) {
+ $maxcount = (int)$row['c'];
+ }
+ $result[] = $row;
+ }
if ($maxcount > 0) {
foreach($result as &$row) {
- $row['width']=(int)(100 * ($row['c']/$maxcount));
+ $row['width']=(int)(100 *
($row['c']/$maxcount));
}
}
- return $result;
+ return $result;
}
+ public function getTotalTracks($since=null) {
+ global $adodb;
+ if ($since) {
+ $query = 'SELECT COUNT(*) FROM Scrobbles WHERE username
= '.$adodb->qstr($this->name).' AND time > '.(int)($since);
+ } else {
+ $query = 'SELECT COUNT(*) FROM Scrobbles WHERE username
= '.$adodb->qstr($this->name);
+ }
+ try {
+ $tracks = $adodb->CacheGetOne(200, $query);
+ } catch (exception $e) {
+ $tracks = 0;
+ }
+
+ return $tracks;
+ }
}
Modified: branches/stable/nixtape/delete-profile.php
===================================================================
--- branches/stable/nixtape/delete-profile.php 2009-05-23 21:13:42 UTC (rev
1751)
+++ branches/stable/nixtape/delete-profile.php 2009-05-23 21:27:10 UTC (rev
1752)
@@ -46,7 +46,7 @@
$smarty->display('error.tpl');
die ();
} else {
- $adodb->Execute('DELETE FROM Scrobble_Sessions WHERE username =
' . $adodb->qstr($username));
+ $adodb->Execute('DELETE FROM Scrobble_Sessions WHERE userid = '
. $adodb->qstr($this_user->uniqueid));
$adodb->Execute('DELETE FROM Delete_Request WHERE username = '
. $adodb->qstr($username));
$adodb->Execute('DELETE FROM Auth WHERE username = ' .
$adodb->qstr($username));
$adodb->Execute('DELETE FROM Group_Members WHERE member = ' .
(int)($this_user->uniqueid));
Modified: branches/stable/nixtape/login.php
===================================================================
--- branches/stable/nixtape/login.php 2009-05-23 21:13:42 UTC (rev 1751)
+++ branches/stable/nixtape/login.php 2009-05-23 21:27:10 UTC (rev 1752)
@@ -42,14 +42,14 @@
if(empty($errors)) {
try {
- $res = $adodb->GetOne('SELECT username FROM Users WHERE '
+ $userid = $adodb->GetOne('SELECT uniqueid FROM Users WHERE '
. ' lower(username) = ' .
$adodb->qstr(strtolower($username))
. ' AND password = ' . $adodb->qstr(md5($password)) . '
AND active = 1');
}
catch (exception $e) {
$errors .= 'A database error happened.';
}
- if(!$res) {
+ if(!$userid) {
$errors .= 'Invalid username or password.';
$smarty->assign('invalid', true);
} else {
@@ -60,8 +60,8 @@
} else {
$session_time = time() + 86400; // 1 day
}
- $adodb->Execute('INSERT INTO Scrobble_Sessions
(username, sessionid, expires) VALUES ('
- . $adodb->qstr($username) . ', '
+ $adodb->Execute('INSERT INTO Scrobble_Sessions (userid,
sessionid, expires) VALUES ('
+ . ($userid) . ', '
. $adodb->qstr($session_id) . ', '
. (int)($session_time) . ')');
Modified: branches/stable/nixtape/radio/xspf.php
===================================================================
--- branches/stable/nixtape/radio/xspf.php 2009-05-23 21:13:42 UTC (rev
1751)
+++ branches/stable/nixtape/radio/xspf.php 2009-05-23 21:27:10 UTC (rev
1752)
@@ -54,18 +54,18 @@
$avail = $res->RecordCount();
-// This needs some kind of deduplication among other things
$tr[0] = rand(0,$avail-1);
$tr[1] = rand(0,$avail-1);
$tr[2] = rand(0,$avail-1);
$tr[3] = rand(0,$avail-1);
$tr[4] = rand(0,$avail-1);
-sort($tr);
+$tr = array_unique($tr);
+// we should probably shuffle these here
$radiotracks = array();
$adodb->SetFetchMode(ADODB_FETCH_ASSOC);
- for($i=0; $i<5; $i++) {
+ for($i=0; $i<count($tr); $i++) {
$res->Move($tr[$i]);
$row = $res->FetchRow();
@@ -96,6 +96,6 @@
$smarty->assign('radiotracks', $radiotracks);
-$smarty->display('radio_xspf.tpl');
+$smarty->display('radio_oldxspf.tpl');
?>
Modified: branches/stable/nixtape/reset.php
===================================================================
--- branches/stable/nixtape/reset.php 2009-05-23 21:13:42 UTC (rev 1751)
+++ branches/stable/nixtape/reset.php 2009-05-23 21:27:10 UTC (rev 1752)
@@ -65,15 +65,15 @@
$smarty->assign('changed', true);
}
-else if (isset($_POST['email'])) {
- $email = $_POST['email'];
+else if (isset($_POST['user'])) {
+ $username = $_POST['user'];
$adodb->SetFetchMode(ADODB_FETCH_ASSOC);
$err = 0;
try {
- $sql = 'SELECT * FROM Users WHERE email=' . $adodb->qstr($email);
- $row = $adodb->GetRow($sql);
+ $row = $adodb->GetRow('SELECT * FROM Users WHERE username="'
+ . $adodb->qstr($username));
}
catch (exception $e) {
$err = 1;
@@ -85,11 +85,9 @@
$smarty->display('error.tpl');
die();
}
-
- $code = md5($row['$username'] . $row['email'] . time());
-
+ $code = md5($username . $row['email'] . time());
$sql = 'INSERT INTO Recovery_Request (username, email, code, expires)
VALUES('
- . $adodb->qstr($row['username']) . ', '
+ . $adodb->qstr($username) . ', '
. $adodb->qstr($row['email']) . ', '
. $adodb->qstr($code) . ', '
. $adodb->qstr(time() + 86400) . ')';
@@ -105,7 +103,8 @@
}
$url = $base_url . '/reset.php?code=' . $code;
- $content = "Hi!\n\nSomeone from the IP-address " .
$_SERVER['REMOTE_ADDR'] . " entered your username, " . $row['username'] . "
into the password reset form at libre.fm. To change your password, please
visit\n\n"
+ $content = "Hi!\n\nSomeone from the IP-address " .
$_SERVER['REMOTE_ADDR'] . " entered your username "
+ . "in the password reset form at libre.fm. To change
you password, please visit\n\n"
. $url . "\n\n- The Libre.fm Team";
sendEmail($content, $row['email']);
$smarty->assign('sent', true);
Modified: branches/stable/nixtape/templating.php
===================================================================
--- branches/stable/nixtape/templating.php 2009-05-23 21:13:42 UTC (rev
1751)
+++ branches/stable/nixtape/templating.php 2009-05-23 21:27:10 UTC (rev
1752)
@@ -58,7 +58,6 @@
$smarty->assign('lang_selector_array', array(($current_lang) => 1));
$smarty->assign('base_url', $base_url);
$smarty->assign('this_page', $_SERVER['REQUEST_URI']);
-$smarty->assign('this_page_for_sure', $_SERVER['SCRIPT_NAME']); // handles
/index.php not /
$smarty->assign('this_page_absolute',
(empty($_SERVER['HTTPS']) ? 'http://' : 'http://')
.(empty($_SERVER['HOST']) ? $_SERVER['SERVER_NAME'] : $_SERVER['HOST'])
Modified: branches/stable/nixtape/themes/librefm/alpha.css
===================================================================
--- branches/stable/nixtape/themes/librefm/alpha.css 2009-05-23 21:13:42 UTC
(rev 1751)
+++ branches/stable/nixtape/themes/librefm/alpha.css 2009-05-23 21:27:10 UTC
(rev 1752)
@@ -12,38 +12,42 @@
*/
-html{background: #ececec;}
+html, body{background: #fff; padding: 0; margin: 0;}
+.inner{margin:auto;text-align:left;width:57.69em;*width:56.25em;}
+
+.inner{width:73.076em;*width:71.25em;}
+
+.inner-p{padding: 10px;}
+
#hd {margin-top: -9px;}
-#bd {background-color: white; padding: 15px;}
+#hd .inner {position: relative;}
-#hd {margin-bottom: 8px; height: 70px; position: relative;}
+#sidebar {background-color: cyan;}
-#hd ul{ margin: 0; padding: 0; line-height: 70px; position: absolute; top: 0;
right: 20px;}
+.yui-u .first {background-color: white;}
+#hd {margin-bottom: 8px; height: 40px; position: relative;}
+
+#hd ul{ margin: 0; padding: 0; line-height: 40px; position: absolute; top: 0;
right: 0px;}
+
#hd li a:link, #hd li a:visited { color: black; text-decoration: none;
padding: 7px; }
#hd li a:hover{background-color: maroon; color: yellow;}
-#login a:link, #login a:visited { color: yellow !important; text-decoration:
underline !important; }
+#hd li #login {font-weight: bold;}
-#hd li{ display: inline; font-size: 21px; text-transform: lowercase;
font-weight: bold; margin-right: 20px;}
+#hd li{ display: inline; text-transform: lowercase; margin-left: 20px;
border-rright: 1px solid #aaa;}
#banner { height: 345px; position: relative;}
#banner img{ position: absolute; top: -12px; left: 0; }
-#sidebar {background-color: #eee;}
-
-#hd, #sidebar, #bd, #artists, #hd li {-moz-border-radius: 8px;}
-
#artists{background-color: lightblue; margin: 15px 0 15px 0; padding: 5px;}
-#links, #moarlinks, #ft{font-size: 85%;}
+#ft{margin-top: 15px; position: relative; background-color: #111; color:
white; margin-bottom: 0 !important;}
-#ft{margin-top: 15px; height: 102px;position: relative;}
-
#ft p{ text-align: right;}
#ft li{ display: inline; margin-right: 0.5em; }
@@ -62,10 +66,10 @@
border: 0;
margin: 0;
padding: 0;
- padding-top: 70px;
+ padding-top: 40px;
height: 0px !important;
- height /**/: 70px;
- width: 950px;
+ height /**/: 40px;
+ width: 120px;
cursor: pointer;
}
@@ -379,12 +383,10 @@
#adbard-librefm{
margin: 0 auto 0 auto;
- height: 248px;
- width: 182px;
+ height: 205px;
+ width: 140px;
position: relative;
- background: transparent url(images/adbard.png) no-repeat;
- margin-top: 1em;
- margin-bottom: 1em;
+ padding: 5px; text-align: center;
}
.cc-license {font-size: 73%; color: red;}
@@ -460,4 +462,10 @@
#register-prompt {background-color: #eee; padding: 12px; border: 5px solid
#aaa;}
-.photo{padding: 1px; border 1px solid #ccc; width: 48px; height: 48px; float:
left;}
\ No newline at end of file
+#purchase-download{background-color: #ececec; -moz-border-radius: 1em;
padding: 15px; float: right;}
+
+.photo{padding: 1px; border 1px solid #ccc; float: left;}
+
+hr {clear: both; height: 0px; color: white !important; background-color:
transparent !important;}
+
+#new-libre-fm{background-color: black; color: white; padding-top: 190px;}
\ No newline at end of file
Modified: branches/stable/nixtape/themes/librefm/templates/album.tpl
===================================================================
--- branches/stable/nixtape/themes/librefm/templates/album.tpl 2009-05-23
21:13:42 UTC (rev 1751)
+++ branches/stable/nixtape/themes/librefm/templates/album.tpl 2009-05-23
21:27:10 UTC (rev 1752)
@@ -16,6 +16,8 @@
alt="{$album->name|escape:'html':'UTF-8'}"
title="{$album->name|escape:'html':'UTF-8'}" width="160" />
</div>
+ <hr />
+
{include file='player.tpl'}
<script type="text/javascript">
Modified: branches/stable/nixtape/themes/librefm/templates/group.tpl
===================================================================
--- branches/stable/nixtape/themes/librefm/templates/group.tpl 2009-05-23
21:13:42 UTC (rev 1751)
+++ branches/stable/nixtape/themes/librefm/templates/group.tpl 2009-05-23
21:27:10 UTC (rev 1752)
@@ -56,6 +56,7 @@
{/section}
</ul>
+{if !isset($this_user) || $this_user->anticommercial<>1}
<!--Ad Bard advertisement snippet, begin -->
<script type='text/javascript'>
@@ -66,6 +67,7 @@
<script type='text/javascript'
src='http://cdn1.adbard.net/js/ab1.js'></script>
<!--Ad Bard, end -->
+{/if}
Modified: branches/stable/nixtape/themes/librefm/templates/menu.tpl
===================================================================
--- branches/stable/nixtape/themes/librefm/templates/menu.tpl 2009-05-23
21:13:42 UTC (rev 1751)
+++ branches/stable/nixtape/themes/librefm/templates/menu.tpl 2009-05-23
21:27:10 UTC (rev 1752)
@@ -8,8 +8,8 @@
{if $this_user->userlevel > 0}
<li><a href="/admin.php">{t}Admin{/t}</a></li>
{/if}
- <li><a href="{$base_url}/login.php?action=logout">{t}Logout{/t}</a></li>
+ <li id="login"><a
href="{$base_url}/login.php?action=logout">{t}Logout{/t}</a></li>
{else}
- <li><a
href="{$base_url}/login.php?return={$this_page|urlencode|htmlentities}">{t}Login{/t}</a></li>
+ <li id="login"><a
href="{$base_url}/login.php?return={$this_page|urlencode|htmlentities}">{t}Login{/t}</a></li>
{/if}
</ul>
Modified: branches/stable/nixtape/themes/librefm/templates/player.tpl
===================================================================
--- branches/stable/nixtape/themes/librefm/templates/player.tpl 2009-05-23
21:13:42 UTC (rev 1751)
+++ branches/stable/nixtape/themes/librefm/templates/player.tpl 2009-05-23
21:27:10 UTC (rev 1752)
@@ -3,7 +3,7 @@
{if $track->streamurl}
<object id="fallbackembed"
style="width:200px;height:50px;" type="application/ogg"
data="{$track->streamurl}"><a type="application/ogg" rel="enclosure"
href="{$track->streamurl}">Listen to this track</a></object>
{elseif isset($radio_session)}
- <p>{t escape=no}Sorry, you need a browser capable of
making use of the HTML 5 <audio> tag to enjoy the streaming service via
the JavaScript player.{/t}</p>
+ <p><!-- {t escape=no}Sorry, you need a browser capable
of making use of the HTML 5 <audio> tag to enjoy the streaming service
via the JavaScript player.{/t}--></p>
{/if}
</audio>
<div id="interface">
Copied: branches/stable/nixtape/themes/librefm/templates/radio_oldxspf.tpl
(from rev 1739, branches/stable/nixtape/themes/librefm/templates/radio_xspf.tpl)
===================================================================
--- branches/stable/nixtape/themes/librefm/templates/radio_oldxspf.tpl
(rev 0)
+++ branches/stable/nixtape/themes/librefm/templates/radio_oldxspf.tpl
2009-05-23 21:27:10 UTC (rev 1752)
@@ -0,0 +1,26 @@
+<playlist version="1"
xmlns:lastfm="http://www.audioscrobbler.net/dtd/xspf-lastfm">
+<title>{$title}</title>
+<creator>libre.fm</creator>
+<link rel="http://www.last.fm/skipsLeft">9999</link>
+<trackList>
+
+{section name=rt loop=$radiotracks}
+ <track>
+
<location>{$radiotracks[rt].location|escape:"html":"UTF-8"}</location>
+ <title>{$radiotracks[rt].title|escape:"html":"UTF-8"}</title>
+ <id>{$radiotracks[rt].id|escape:"html":"UTF-8"}</id>
+ <album>{$radiotracks[rt].album|escape:"html":"UTF-8"}</album>
+ <creator>{$radiotracks[rt].creator|escape:"html":"UTF-8"}</creator>
+
<duration>{$radiotracks[rt].duration|escape:"html":"UTF-8"}</duration>
+ <image>{$radiotracks[rt].image|escape:"html":"UTF-8"}</image>
+ <link
rel="http://www.last.fm/artistpage">{$radiotracks[rt].artisturl|escape:"html":"UTF-8"}</link>
+ <link
rel="http://www.last.fm/albumpage">{$radiotracks[rt].albumurl|escape:"html":"UTF-8"}</link>
+ <link
rel="http://www.last.fm/trackpage">{$radiotracks[rt].trackurl|escape:"html":"UTF-8"}</link>
+ <link rel="http://www.last.fm/buyTrackURL"></link>
+ <link rel="http://www.last.fm/buyAlbumURL"></link>
+ <link
rel="http://www.last.fm/freeTrackURL">{$radiotracks[rt].downloadurl|escape:"html":"UTF-8"}</link>
+ </track>
+{/section}
+
+</trackList>
+</playlist>
Modified: branches/stable/nixtape/themes/librefm/templates/radio_xspf.tpl
===================================================================
--- branches/stable/nixtape/themes/librefm/templates/radio_xspf.tpl
2009-05-23 21:13:42 UTC (rev 1751)
+++ branches/stable/nixtape/themes/librefm/templates/radio_xspf.tpl
2009-05-23 21:27:10 UTC (rev 1752)
@@ -1,26 +1,36 @@
-<playlist version="1"
xmlns:lastfm="http://www.audioscrobbler.net/dtd/xspf-lastfm">
+<?xml version="1.0" encoding="utf-8"?>
+<lfm status="ok">
+<playlist version="1" xmlns="http://xspf.org/ns/0/">
<title>{$title}</title>
<creator>libre.fm</creator>
-<link rel="http://www.last.fm/skipsLeft">9999</link>
+<date>{$date}</date>
+<link rel="http://www.last.fm/expiry">3600</link>
<trackList>
{section name=rt loop=$radiotracks}
<track>
<location>{$radiotracks[rt].location|escape:"html":"UTF-8"}</location>
<title>{$radiotracks[rt].title|escape:"html":"UTF-8"}</title>
- <id>{$radiotracks[rt].id|escape:"html":"UTF-8"}</id>
+ <identifier>{$radiotracks[rt].id|escape:"html":"UTF-8"}</identifier>
<album>{$radiotracks[rt].album|escape:"html":"UTF-8"}</album>
<creator>{$radiotracks[rt].creator|escape:"html":"UTF-8"}</creator>
<duration>{$radiotracks[rt].duration|escape:"html":"UTF-8"}</duration>
<image>{$radiotracks[rt].image|escape:"html":"UTF-8"}</image>
- <link
rel="http://www.last.fm/artistpage">{$radiotracks[rt].artisturl|escape:"html":"UTF-8"}</link>
- <link
rel="http://www.last.fm/albumpage">{$radiotracks[rt].albumurl|escape:"html":"UTF-8"}</link>
- <link
rel="http://www.last.fm/trackpage">{$radiotracks[rt].trackurl|escape:"html":"UTF-8"}</link>
- <link rel="http://www.last.fm/buyTrackURL"></link>
- <link rel="http://www.last.fm/buyAlbumURL"></link>
- <link
rel="http://www.last.fm/freeTrackURL">{$radiotracks[rt].downloadurl|escape:"html":"UTF-8"}</link>
+ <extension application="http://alpha.libre.fm/">
+ <trackauth>00000</trackauth>
+ <albumid>00000</albumid>
+ <artistid>00000</artistid>
+ <recording>00000</recording>
+
<artistpage>{$radiotracks[rt].artisturl|escape:"html":"UTF-8"}</artistpage>
+
<albumpage>{$radiotracks[rt].albumurl|escape:"html":"UTF-8"}</albumpage>
+
<trackpage>{$radiotracks[rt].trackurl|escape:"html":"UTF-8"}</trackpage>
+ <buyTrackURL></buyTrackURL>
+ <buyAlbumURL></buyAlbumURL>
+
<freeTrackURL>{$radiotracks[rt].downloadurl|escape:"html":"UTF-8"}</freeTrackURL>
+ </extension>
</track>
{/section}
</trackList>
</playlist>
+</lfm>
Modified: branches/stable/nixtape/themes/librefm/templates/register.tpl
===================================================================
--- branches/stable/nixtape/themes/librefm/templates/register.tpl
2009-05-23 21:13:42 UTC (rev 1751)
+++ branches/stable/nixtape/themes/librefm/templates/register.tpl
2009-05-23 21:27:10 UTC (rev 1752)
@@ -7,8 +7,6 @@
{elseif isset($registered) }
<h2>{t}You're now registered with libre.fm! An email has been sent to
the email address you provided. Please follow the link in the email to activate
your account!{/t}</h2>
-
- <p><strong>If you've used Last.fm in the past, and would like to import
all your previous listening data, you can -- either <a
href="http://ideas.libre.fm/index.php/Using_lastscrape">do it yourself</a> or
<a href="https://savannah.nongnu.org/bugs/?func=additem&group=librefm">create a
ticket and we'll do it for you</a> — be sure to include both your
libre.fm username and last.fm username and we'll do the rest.</strong></p>
<ul>
<li><a href="http://ideas.libre.fm/index.php/Using_turtle">{t}Find out
how to start sending us your listening habits{/t}</a></li>
Modified: branches/stable/nixtape/themes/librefm/templates/reset.tpl
===================================================================
--- branches/stable/nixtape/themes/librefm/templates/reset.tpl 2009-05-23
21:13:42 UTC (rev 1751)
+++ branches/stable/nixtape/themes/librefm/templates/reset.tpl 2009-05-23
21:27:10 UTC (rev 1752)
@@ -20,8 +20,8 @@
<form action="{$base_url}/reset.php" method='post'>
<fieldset>
- <label for='email'>{t}Email address{/t}</span></label>
- <input id='email' name='email' type='text' value='' />
+ <label for='username'>{t}Username{/t}</span></label>
+ <input id='username' name='user' type='text' value='' />
<input type='submit' name='recover' value='{t}Reset my
password!{/t}'/>
</fieldset>
Modified: branches/stable/nixtape/themes/librefm/templates/track.tpl
===================================================================
--- branches/stable/nixtape/themes/librefm/templates/track.tpl 2009-05-23
21:13:42 UTC (rev 1751)
+++ branches/stable/nixtape/themes/librefm/templates/track.tpl 2009-05-23
21:27:10 UTC (rev 1752)
@@ -4,6 +4,8 @@
<h2 property="dc:title" class="fn" rel="foaf:page"
rev="foaf:primaryTopic" resource="">{$track->name|escape:'html':'UTF-8'}</h2>
+ <hr />
+
{include file='player.tpl'}
<script type="text/javascript">
var playlist = [{ldelim}"artist" : "{$track->artist_name}",
"album" : "{$track->album_name}", "track" : "{$track->name}", "url" :
"{$track->streamurl}"{rdelim}];
Modified: branches/stable/nixtape/themes/librefm/templates/user-edit.tpl
===================================================================
--- branches/stable/nixtape/themes/librefm/templates/user-edit.tpl
2009-05-23 21:13:42 UTC (rev 1751)
+++ branches/stable/nixtape/themes/librefm/templates/user-edit.tpl
2009-05-23 21:27:10 UTC (rev 1752)
@@ -59,6 +59,11 @@
<td><a href="#dfn_journal_rss" rel="glossary">{t}What's
this?{/t}</a></td>
</tr>
<tr>
+ <th align="right" valign="top"><label
for="anticommercial">{t}Anticommercial{/t}</label></th>
+ <td><input name="anticommercial" id="anticommercial"
type="checkbox"{if $anticommercial == 1} checked="checked"{/if} /></td>
+ <td><a href="#dfn_anticommercial"
rel="glossary">{t}What's this?{/t}</a></td>
+ </tr>
+ <tr>
<th align="right" valign="top"><label
for="password_1">{t}Password:{/t}</label></th>
<td><input name="password_1" id="password_1"
type="password" value="" /></td>
<td rowspan="2">{t}Leave this blank if you don't want
to change your password.{/t}</td>
@@ -88,6 +93,12 @@
<dt id="dfn_id">WebID (FOAF)</dt>
<dd>{t escape=no}A URI that represents you in RDF. See <a
href="http://esw.w3.org/topic/WebID">WebID</a> for details. If you don't know
what this is, it's best to leave it blank.{/t}</dd>
+
+ <dt id="dfn_anticommercial">Anticommercial</dt>
+ <dd>{t escape=no}By enabling this option, you will not be shown
advertisements or affiliate purchase links.{/t}</dd>
</dl>
{include file='footer.tpl'}
+</dl>
+
+{include file='footer.tpl'}
Modified:
branches/stable/nixtape/themes/librefm/templates/user-recent-tracks.tpl
===================================================================
--- branches/stable/nixtape/themes/librefm/templates/user-recent-tracks.tpl
2009-05-23 21:13:42 UTC (rev 1751)
+++ branches/stable/nixtape/themes/librefm/templates/user-recent-tracks.tpl
2009-05-23 21:27:10 UTC (rev 1752)
@@ -33,7 +33,7 @@
<div><a class="fn" property="dc:title" rel="foaf:page"
href="{$scrobbles[i].trackurl|escape:'html':'UTF-8'}">{$scrobbles[i].track|escape:'html':'UTF-8'}</a></div>
<small about="{$scrobbles[i].id|escape:'html':'UTF-8'}"
property="dc:date" content="{$scrobbles[i].timeiso}" datatype="xsd:dateTime"
title="{$scrobbles[i].timeiso}">{$scrobbles[i].timehuman}</small>
<span about="{$scrobbles[i].id|escape:'html':'UTF-8'}"
property="rss:link" content="{$scrobbles[i].trackurl|escape:'html':'UTF-8'}">
- <span property="rss:description" content="{if
$scrobbles[i].album}{$scrobbles[i].album}{else}Unknown album{/if}">
+ <span property="rss:description" content="{if
$scrobbles[i].album}{$scrobbles[i].album|escape:'html':'UTF-8'}{else}{t}Unknown
album{/t}{/if}">
<span property="rss:title"
content="{$scrobbles[i].artist|escape:'html':'UTF-8'}:
{$scrobbles[i].track|escape:'html':'UTF-8'}"
rev="rdf:_{$smarty.section.i.index_next}" resource="[_:seq1]"></span>
</span>
</span>
Modified: branches/stable/nixtape/themes/librefm/templates/user-stats.tpl
===================================================================
--- branches/stable/nixtape/themes/librefm/templates/user-stats.tpl
2009-05-23 21:13:42 UTC (rev 1751)
+++ branches/stable/nixtape/themes/librefm/templates/user-stats.tpl
2009-05-23 21:27:10 UTC (rev 1752)
@@ -4,6 +4,10 @@
{include file='maxiprofile.tpl'}
+<ul>
+<li>Total tracks: {$totaltracks}</li>
+</ul>
+
<h3 id="stats_by_artist">{t name=$me->name|escape:'html':'UTF-8'}%1's most
played artists{/t}</h3>
<table class="stats_artists" about="{$me->id}">
{section name=i loop=$user_playstats}
Modified: branches/stable/nixtape/track.php
===================================================================
--- branches/stable/nixtape/track.php 2009-05-23 21:13:42 UTC (rev 1751)
+++ branches/stable/nixtape/track.php 2009-05-23 21:27:10 UTC (rev 1752)
@@ -25,7 +25,7 @@
require_once('data/Server.php');
require_once('data/TagCloud.php');
-$track = new Track(urldecode($_GET['track']), urldecode($_GET['artist']));
+$track = new Track($_GET['track'], $_GET['artist']);
$smarty->assign('track', $track);
$album = new Album($track->album_name, $track->artist_name);
@@ -43,13 +43,11 @@
$adodb->SetFetchMode(ADODB_FETCH_ASSOC);
$res = $adodb->GetAll('SELECT * FROM Track WHERE lower(artist_name) = ' .
$adodb->qstr(mb_strtolower($track->artist_name, 'UTF-8')) . ' AND lower(name) =
' . $adodb->qstr(mb_strtolower($track->name, 'UTF-8')));
-$aOtheralbums = array();
-$i = 0;
+$aOtherAlbums = array();
-foreach($res as &$row) {
- $trow = sanitize($row);
+foreach($res as &$trow) {
if ($trow['album']) {
- $aOtherAlbums[$i++] = new Album($trow['album'],
$trow['artist']);
+ $aOtherAlbums[] = new Album($trow['album'], $trow['artist']);
}
}
Modified: branches/stable/nixtape/user-edit.php
===================================================================
--- branches/stable/nixtape/user-edit.php 2009-05-23 21:13:42 UTC (rev
1751)
+++ branches/stable/nixtape/user-edit.php 2009-05-23 21:27:10 UTC (rev
1752)
@@ -113,6 +113,7 @@
$this_user->avatar_uri = $_POST['avatar_uri'];
$this_user->laconica_profile = $_POST['laconica_profile'];
$this_user->journal_rss = $_POST['journal_rss'];
+ $this_user->anticommercial = $_POST['anticommercial'] == "on"
? 1 : 0;
if (!empty( $_POST['password_1'] ))
$user->password = md5($_POST['password_1']);
@@ -155,6 +156,7 @@
$smarty->assign('avatar_uri', $_POST['avatar_uri']);
$smarty->assign('laconica_profile', $_POST['laconica_profile']);
$smarty->assign('journal_rss', $_POST['journal_rss']);
+ $smarty->assign('anticommercial', $_POST['anticommercial'] ==
"on" ? 1 : 0);
}
else
{
@@ -167,6 +169,7 @@
$smarty->assign('avatar_uri', ($this_user->avatar_uri));
$smarty->assign('laconica_profile',
($this_user->laconica_profile));
$smarty->assign('journal_rss', ($this_user->journal_rss));
+ $smarty->assign('anticommercial', $this_user->anticommercial);
}
# And display the page.
Modified: branches/stable/nixtape/user-stats.php
===================================================================
--- branches/stable/nixtape/user-stats.php 2009-05-23 21:13:42 UTC (rev
1751)
+++ branches/stable/nixtape/user-stats.php 2009-05-23 21:27:10 UTC (rev
1752)
@@ -52,7 +52,15 @@
$smarty->assign('user_daystats',$aUserDayStat);
} catch (exception $e) {}
- $smarty->assign('toptracks', $user->getTopTracks(40));
+ try {
+ $smarty->assign('toptracks', $user->getTopTracks(40));
+ } catch (exception $e) {
+ $smarty->assign('error', 'Error!');
+ $smarty->assign('details', 'Couldn\'t get your top tracks!');
+ $smarty->display('error.tpl');
+ die();
+ }
+ $smarty->assign('totaltracks', $user->getTotalTracks());
$smarty->assign('me', $user);
$smarty->assign('geo', Server::getLocationDetails($user->location_uri));
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Librefm-commits] [1752] partial merge of gnukebox/ and nixtape/ from trunk,
Clint Adams <=