[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Librefm-commits] [1550] whitespace
From: |
Clint Adams |
Subject: |
[Librefm-commits] [1550] whitespace |
Date: |
Thu, 14 May 2009 03:28:54 +0000 |
Revision: 1550
http://svn.sv.gnu.org/viewvc/?view=rev&root=librefm&revision=1550
Author: clint
Date: 2009-05-14 03:28:54 +0000 (Thu, 14 May 2009)
Log Message:
-----------
whitespace
Modified Paths:
--------------
trunk/nixtape/album.php
trunk/nixtape/api/xml.php
trunk/nixtape/data/Album.php
trunk/nixtape/data/Artist.php
trunk/nixtape/data/Group.php
trunk/nixtape/data/Server.php
trunk/nixtape/data/Statistic.php
trunk/nixtape/data/TagCloud.php
trunk/nixtape/data/Track.php
trunk/nixtape/data/User.php
Modified: trunk/nixtape/album.php
===================================================================
--- trunk/nixtape/album.php 2009-05-14 03:23:45 UTC (rev 1549)
+++ trunk/nixtape/album.php 2009-05-14 03:28:54 UTC (rev 1550)
@@ -44,8 +44,7 @@
'href' =>
$base_url.'/rdf.php?fmt=xml&page='.urlencode(htmlentities(str_replace($base_url,
'', $album->getURL())))
)
));
-
+
$smarty->display('album.tpl');
-
?>
Modified: trunk/nixtape/api/xml.php
===================================================================
--- trunk/nixtape/api/xml.php 2009-05-14 03:23:45 UTC (rev 1549)
+++ trunk/nixtape/api/xml.php 2009-05-14 03:28:54 UTC (rev 1550)
@@ -19,15 +19,15 @@
*/
class XML {
-
+
public static function prettyXML($xml) {
- $dom = new DOMDocument('1.0');
+ $dom = new DOMDocument('1.0');
$dom->preserveWhitespace = false;
$dom->loadXML($xml->asXML());
$dom->formatOutput = true;
return($dom->saveXML());
- }
-
+ }
+
public static function error($status, $errcode, $errtext) {
$xml = new SimpleXMLElement('<lfm></lfm>');
$xml->addAttribute('status', $status);
Modified: trunk/nixtape/data/Album.php
===================================================================
--- trunk/nixtape/data/Album.php 2009-05-14 03:23:45 UTC (rev 1549)
+++ trunk/nixtape/data/Album.php 2009-05-14 03:28:54 UTC (rev 1550)
@@ -28,7 +28,7 @@
/**
* Represents album data
*
- * General album attributes are accessible as public variables.
+ * General album attributes are accessible as public variables.
* Lists of tracks are only generated when requested.
*/
class Album {
@@ -153,7 +153,7 @@
$image = $aws_xml->Items->Item->MediumImage->URL;
$URI = $aws_xml->Items->Item->DetailPageURL;
-
+
if ($image) {
if ($license == '') { $license = 'amazon'; }
@@ -166,7 +166,7 @@
$sql = ('UPDATE Album SET image = '
. ($image) . ', '
. ' artwork_license = '
- . ($license) . ' WHERE artist_name = '. ($artist)
+ . ($license) . ' WHERE artist_name = '. ($artist)
. ' AND name = ' . ($album));
try {
Modified: trunk/nixtape/data/Artist.php
===================================================================
--- trunk/nixtape/data/Artist.php 2009-05-14 03:23:45 UTC (rev 1549)
+++ trunk/nixtape/data/Artist.php 2009-05-14 03:28:54 UTC (rev 1550)
@@ -30,7 +30,7 @@
/**
* Represents artist data
*
- * General artist attributes are accessible as public variables.
+ * General artist attributes are accessible as public variables.
* Lists of tracks and albums are only generated when requested.
*/
class Artist {
@@ -82,7 +82,7 @@
foreach($res as &$row) {
$albums[] = new Album($row['name'], $this->name);
}
-
+
return $albums;
}
Modified: trunk/nixtape/data/Group.php
===================================================================
--- trunk/nixtape/data/Group.php 2009-05-14 03:23:45 UTC (rev 1549)
+++ trunk/nixtape/data/Group.php 2009-05-14 03:28:54 UTC (rev 1550)
@@ -52,11 +52,11 @@
else {
global $mdb2;
$res = $mdb2->query('SELECT * FROM Groups WHERE
lower(groupname) = ' . $mdb2->quote(strtolower($name), 'text'));
-
+
if(PEAR::isError($res)) {
header('Content-Type: text/plain');
////($res);
-
+
exit;
}
@@ -64,7 +64,7 @@
$row = $res->fetchRow(MDB2_FETCHMODE_ASSOC);
}
}
-
+
if (is_array($row)) {
$this->gid = $row['id'];
$this->name = $row['groupname'];
@@ -77,9 +77,9 @@
$this->users = array();
if (! preg_match('/\:/', $this->id))
$this->id = $base.'/group/' .
rawurlencode($this->name) . '#group';
- }
+ }
}
-
+
/**
* Selects a random nixtape group.
*
@@ -89,7 +89,7 @@
static function random ()
{
global $mdb2;
-
+
if ( strtolower(substr($mdb2->phptype, 0, 5)) == 'mysql' )
{
$random = 'RAND';
@@ -141,7 +141,7 @@
{
return (new PEAR_Error("Not allowed to create a group
called '{$name}' (reserved word)!"));
}
-
+
// Check to make sure no existing group with same name
(case-insensitive).
$q = sprintf('SELECT groupname FROM Groups WHERE
LOWER(groupname)=LOWER(%s)'
, $mdb2->quote($name, 'text'));
@@ -160,7 +160,7 @@
"The name '{$name}' it too similar to
existing group '{$existing}'"
));
}
-
+
// Create new group
$q = sprintf('INSERT INTO Groups (groupname, owner, created,
modified) VALUES (%s, %s, %d, %d)'
, $mdb2->quote($name, 'text')
@@ -200,7 +200,7 @@
// Return the newly created group. Callers should check the
return value.
return (new Group($name));
}
-
+
static function groupList ($user=false)
{
global $mdb2;
@@ -223,7 +223,7 @@
.'LEFT JOIN Group_Members gm ON gm.grp=g.id '
.'GROUP BY g.groupname, g.owner, g.fullname,
g.bio, g.homepage, g.created, g.modified, g.avatar_uri, g.grouptype');
}
-
+
if(PEAR::isError($res))
{
header('Content-Type: text/plain');
@@ -241,11 +241,11 @@
return $list;
}
-
+
function save ()
{
global $mdb2;
-
+
$q = sprintf('UPDATE Groups SET '
. 'owner=%s, '
. 'fullname=%s, '
@@ -261,9 +261,9 @@
, $mdb2->quote($this->avatar_uri, 'text')
, time()
, $mdb2->quote($this->name, 'text'));
-
+
$res = $mdb2->query($q);
-
+
if(PEAR::isError($res)) {
header('Content-Type: text/plain');
////($res);
@@ -289,7 +289,7 @@
function getURL() {
return Server::getGroupURL($this->name);
}
-
+
function getURLAction ($action) {
$url = $this->getURL();
if (strstr($url, '?'))
@@ -297,7 +297,7 @@
else
return $url . '?action=' . rawurlencode($action);
}
-
+
function getUsers () {
global $mdb2;
@@ -315,7 +315,7 @@
$this->users[ $row['username'] ] = new
User($row['username'], $row);
}
}
-
+
$this->count = count($this->users);
}
@@ -328,22 +328,22 @@
return true;
return false;
}
-
+
function memberJoin ($user) {
if ($this->memberCheck($user))
return false;
-
+
global $mdb2;
$res = $mdb2->query(sprintf('INSERT INTO Group_Members (grp,
member, joined) VALUES (%s, %s, %d)',
$mdb2->quote($this->gid, 'integer'),
$mdb2->quote($user->name, 'text'),
time()));
-
+
if(PEAR::isError($res))
{
return false;
}
-
+
$this->users[ $user->name ] = $user;
return true;
}
@@ -351,19 +351,19 @@
function memberLeave ($user) {
if (!$this->memberCheck($user))
return false;
-
+
// Group owner cannot leave, so we need a way to reassign
ownership.
if ($this->owner->name == $user->name)
return false;
-
+
global $mdb2;
$res = $mdb2->query(sprintf('DELETE FROM Group_Members WHERE
grp=%s AND member=%s',
$mdb2->quote($this->gid, 'integer'),
$mdb2->quote($user->uniqueid, 'integer')));
-
+
if(PEAR::isError($res))
return false;
-
+
$this->users[ $user->name ] = null;
// The array key still exists though. That's annoying. PHP
needs an equivalent of Perl's 'delete'.
// This shouldn't actually cause us any problems, but people
should be aware of the oddness.
Modified: trunk/nixtape/data/Server.php
===================================================================
--- trunk/nixtape/data/Server.php 2009-05-14 03:23:45 UTC (rev 1549)
+++ trunk/nixtape/data/Server.php 2009-05-14 03:28:54 UTC (rev 1550)
@@ -27,8 +27,8 @@
require_once($install_path . '/data/sanitize.php');
require_once($install_path . '/utils/linkeddata.php');
require_once($install_path . '/utils/arc/ARC2.php');
-require_once($install_path . '/utils/resolve-external.php');
-require_once($install_path . '/utils/licenses.php');
+require_once($install_path . '/utils/resolve-external.php');
+require_once($install_path . '/utils/licenses.php');
/**
* Provides access to server-wide data
@@ -51,18 +51,18 @@
if($username) {
$res = $adodb->CacheGetAll(60,
'SELECT
- s.username,
- s.artist,
- s.track,
- s.album,
- s.time,
- s.mbid,
+ s.username,
+ s.artist,
+ s.track,
+ s.album,
+ s.time,
+ s.mbid,
a.mbid AS artist_mbid,
l.mbid AS album_mbid,
l.image AS album_image,
l.artwork_license,
t.license
- FROM Scrobbles s
+ FROM Scrobbles s
LEFT JOIN Artist a
ON s.artist=a.name
LEFT JOIN Album l
@@ -72,15 +72,15 @@
ON s.stid = st.id
LEFT JOIN Track t
ON st.track = t.id
- WHERE lower(s.username) = ' .
$adodb->qstr(strtolower($username)) . '
+ WHERE lower(s.username) = ' .
$adodb->qstr(strtolower($username)) . '
ORDER BY
- s.time DESC
+ s.time DESC
LIMIT ' . (int)($number));
} else {
$res = $adodb->CacheGetAll(60,
'SELECT
s.username,
- s.artist,
+ s.artist,
s.track,
s.album,
s.time,
@@ -101,7 +101,7 @@
LEFT JOIN Track t
ON st.track = t.id
ORDER BY
- s.time DESC
+ s.time DESC
LIMIT ' . (int)($number));
}
}
@@ -111,7 +111,7 @@
foreach($res as &$i) {
$row = sanitize($i);
-
+
$row['userurl'] = Server::getUserURL($row['username']);
if ($row['album']) {
$row['albumurl'] =
Server::getAlbumURL($row['artist'], $row['album']);
@@ -121,7 +121,7 @@
$row['timehuman'] = human_timestamp($row['time']);
$row['timeiso'] = date('c', (int)$row['time']);
-
+
$row['id'] =
identifierScrobbleEvent($row['username'], $row['artist'], $row['track'],
$row['album'], $row['time'], $row['mbid'], $row['artist_mbid'],
$row['album_mbid']);
$row['id_artist'] = identifierArtist($row['username'],
$row['artist'], $row['track'], $row['album'], $row['time'], $row['mbid'],
$row['artist_mbid'], $row['album_mbid']);
$row['id_track'] = identifierTrack($row['username'],
$row['artist'], $row['track'], $row['album'], $row['time'], $row['mbid'],
$row['artist_mbid'], $row['album_mbid']);
@@ -139,7 +139,7 @@
$row['licenseurl'] = $row['license'];
$row['license'] = simplify_license($row['licenseurl']);
-
+
$result[] = $row;
}
@@ -232,7 +232,7 @@
ORDER BY t.streamable DESC, n.expires
DESC LIMIT ' . (int)($number));
}
}
- catch (exception $e) {
+ catch (exception $e) {
return false;
}
@@ -250,13 +250,13 @@
$row['userurl'] = Server::getUserURL($row['username']);
$row['artisturl'] =
Server::getArtistURL($row['artist']);
$row['trackurl'] = Server::getTrackURL($row['artist'],
$row['album'], $row['track']);
-
+
// We really want to get an image URI from the database
and only fall back to qm50.png if we can't find an image.
$row['albumart'] = $base_url . 'themes/' .
$default_theme . '/images/qm50.png';
$row['licenseurl'] = $row['license'];
$row['license'] = simplify_license($row['licenseurl']);
-
+
$result[] = $row;
}
@@ -333,7 +333,7 @@
static function getLocationDetails($name) {
global $adodb;
-
+
if (!$name)
return array();
@@ -342,15 +342,15 @@
. 'FROM Places p '
. 'LEFT JOIN Countries c ON p.country=c.country '
. 'WHERE p.location_uri=' . $adodb->qstr($name,
'text'));
-
+
if($rv) {
-
+
if (! ($rv['latitude'] && $rv['longitude'] &&
$rv['country'])) {
-
+
$parser = ARC2::getRDFXMLParser();
$parser->parse($name);
$index = $parser->getSimpleIndex();
-
+
$rv = array(
'latitude' =>
$index[$name]['http://www.w3.org/2003/01/geo/wgs84_pos#lat'][0],
'longitude' =>
$index[$name]['http://www.w3.org/2003/01/geo/wgs84_pos#long'][0],
@@ -368,7 +368,7 @@
$parser = ARC2::getRDFXMLParser();
$parser->parse($name);
$index = $parser->getSimpleIndex();
-
+
$rv = array(
'latitude' =>
$index[$name]['http://www.w3.org/2003/01/geo/wgs84_pos#lat'][0],
'longitude' =>
$index[$name]['http://www.w3.org/2003/01/geo/wgs84_pos#long'][0],
@@ -381,7 +381,7 @@
(float)$rv['longitude'],
$adodb->qstr($rv['country'])));
}
-
+
return $rv;
}
Modified: trunk/nixtape/data/Statistic.php
===================================================================
--- trunk/nixtape/data/Statistic.php 2009-05-14 03:23:45 UTC (rev 1549)
+++ trunk/nixtape/data/Statistic.php 2009-05-14 03:28:54 UTC (rev 1550)
@@ -35,7 +35,7 @@
*/
static function generatePlayStats($table, $field, $limit = 40,
$constraint = null, $maxwidth = 100 ) {
global $mdb2;
- if (!is_string($field)) return false;
+ if (!is_string($field)) return false;
if (!is_string($table)) return false;
if (!is_integer($limit)) return false;
$query = 'SELECT ' . $field . ', count(*) AS count FROM ' .
$table;
@@ -50,7 +50,7 @@
if (PEAR::isError($res)) {
echo('ERROR' . $res->getMessage());
}
-
+
if (!$res->numRows()) {
return false;
} else {
@@ -61,24 +61,24 @@
$i['pageurl'] =
Server::getArtistURL($i['artist']);
$i['size'] = $i['count'] / $max * $maxwidth;
}
-
+
return $data;
}
}
-
+
static function generatePlayByDays($table, $limit = 100, $constraint =
null, $maxwidth = 100 ) {
global $mdb2;
global $connect_string;
-
+
if (!is_string($table)) return false;
if (!is_integer($limit)) return false;
-
+
/*
- * todo: completly remove this dirty db type check.
+ * todo: completly remove this dirty db type check.
*/
$query = 'SELECT COUNT(*) as count, DATE(TO_TIMESTAMP(time)) as
date FROM ' . $table;
if( strpos($connect_string , 'mysql' ) === 0 ) $query = 'SELECT
COUNT(*) as count,DATE(FROM_UNIXTIME(time)) as date FROM ' . $table;
-
+
$query .= (!is_null($constraint)) ? ' WHERE ' : null;
$query .= (!is_null($constraint)) ? ' username = ' .
$mdb2->quote($constraint, 'text') : null;
$query .= ' GROUP BY date ORDER BY date DESC LIMIT ' . $limit;
@@ -86,9 +86,9 @@
if (PEAR::isError($res)) {
echo('ERROR' . $res->getMessage());
}
-
+
if (!$res->numRows()) {
- return false;
+ return false;
} else {
$data = $res->fetchAll(MDB2_FETCHMODE_ASSOC);
@@ -97,7 +97,7 @@
foreach($data as &$i){
if( $i['count'] > $max ) $max = $i['count'];
}
-
+
foreach($data as &$i){
$i['size'] = $i['count'] / $max * $maxwidth;
}
Modified: trunk/nixtape/data/TagCloud.php
===================================================================
--- trunk/nixtape/data/TagCloud.php 2009-05-14 03:23:45 UTC (rev 1549)
+++ trunk/nixtape/data/TagCloud.php 2009-05-14 03:28:54 UTC (rev 1550)
@@ -23,7 +23,7 @@
require_once($install_path . '/config.php'); // Should already be required
though.
class TagCloud {
-
+
/*
* returns an array counting appareances of a given field and his
corresponding font-size.
* @param string $table table name to be queried
@@ -36,7 +36,7 @@
*/
static function generateTagCloud($table, $field, $limit = 40,
$constraint = null, $constrained_field = false) {
global $adodb;
- if (!is_string($field)) return false;
+ if (!is_string($field)) return false;
if (!is_string($table)) return false;
if (!is_integer($limit)) return false;
$sizes = array('xx-large', 'x-large', 'large', 'medium',
'small', 'x-small', 'xx-small');
@@ -65,7 +65,7 @@
return $res;
}
}
-
+
/**
* Returns the preferred table to generate scrobble data from.
*
@@ -77,17 +77,17 @@
{
// 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';
}
}
Modified: trunk/nixtape/data/Track.php
===================================================================
--- trunk/nixtape/data/Track.php 2009-05-14 03:23:45 UTC (rev 1549)
+++ trunk/nixtape/data/Track.php 2009-05-14 03:28:54 UTC (rev 1550)
@@ -31,7 +31,7 @@
/**
* Represents track data
*
- * All track attributes are accessible as public variables.
+ * All track attributes are accessible as public variables.
*/
class Track {
@@ -66,7 +66,7 @@
$this->licenseurl = $row['license'];
$this->downloadurl =
resolve_external_url($row['downloadurl']);
$this->streamurl =
resolve_external_url($row['streamurl']);
-
+
$this->id = identifierTrack(null, $this->artist_name,
$this->name, $this->album_name, null, $this->mbid, null, null);
}
Modified: trunk/nixtape/data/User.php
===================================================================
--- trunk/nixtape/data/User.php 2009-05-14 03:23:45 UTC (rev 1549)
+++ trunk/nixtape/data/User.php 2009-05-14 03:28:54 UTC (rev 1550)
@@ -78,15 +78,15 @@
$this->created = $row['created'];
$this->modified = $row['modified'];
$this->uniqueid = $row['uniqueid'];
-
+
$this->has_identica =
preg_match('#^http://identi\.ca/#i', $this->laconica_profile);
-
+
if (! preg_match('/\:/', $this->id))
$this->id = $this->getURL() . '#me';
- }
+ }
}
-
-
+
+
public static function new_from_uniqueid_number ($uid)
{
global $adodb;
@@ -100,17 +100,17 @@
return false;
}
}
-
+
function save ()
{
global $adodb;
-
+
// It appears we just discard this data, but this is here for a
reason!
// getLocationDetails will fill in latitude,longitude details
into the Places table in the database
// if it's not already there. This is important as the
location_uri field is a foreign key.
if (!empty($this->location_uri))
$dummy =
Server::getLocationDetails($this->location_uri);
-
+
$q = sprintf('UPDATE Users SET '
. 'email=%s, ' # Send a confirmation email
first??
. 'password=%s, '
@@ -140,9 +140,9 @@
, $adodb->qstr($this->journal_rss)
, time()
, $adodb->qstr($this->name));
-
+
$res = $adodb->Execute($q);
-
+
if(PEAR::isError($res)) {
header('Content-Type: text/plain');
//($res);
@@ -173,7 +173,7 @@
function getAvatar($size=64) {
if (!empty($this->avatar_uri))
return $this->avatar_uri;
-
+
return 'http://www.gravatar.com/avatar/' . md5($this->email) .
'?s=' . $size . '&d=monsterid';
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Librefm-commits] [1550] whitespace,
Clint Adams <=