Commit d06e099c authored by clint's avatar clint

whitespace

parent 53c7011c
......@@ -67,12 +67,12 @@ $request=
$aws_xml = simplexml_load_file($request) or die("xml response not loading");
$image = $aws_xml->Items->Item->MediumImage->URL;
if (!$image) { $image = "/i/qm50.png"; $license="librefm";}
if ($image) {
if ($license == "") { $license = "amazon"; }
$license = $adodb->qstr($license);
......@@ -80,7 +80,7 @@ $image = $aws_xml->Items->Item->MediumImage->URL;
$album = $adodb->qstr($album);
$artist = $adodb->qstr($artist);
$sql = ("UPDATE Album SET image = "
$sql = ("UPDATE Album SET image = "
. ($image) . ", "
......
......@@ -166,7 +166,7 @@ if (isset($_POST['install'])) {
streamurl VARCHAR(255),
otherid VARCHAR(16))");
}
$adodb->Execute("CREATE TABLE Scrobbles(
username VARCHAR(64) REFERENCES Users(username),
track VARCHAR(255),
......@@ -226,7 +226,7 @@ if (isset($_POST['install'])) {
username VARCHAR(64),
email VARCHAR(255),
code VARCHAR(32),
expires INTEGER,
expires INTEGER,
PRIMARY KEY(username))");
$adodb->Execute("CREATE TABLE Radio_Sessions(
......@@ -235,11 +235,11 @@ if (isset($_POST['install'])) {
url VARCHAR(255),
expires INTEGER NOT NULL DEFAULT 0,
PRIMARY KEY(username,session))");
//Table for delete profile requests
//Table for delete profile requests
$adodb->Execute("CREATE TABLE Delete_Request (
code VARCHAR(300),
expires INTEGER,
code VARCHAR(300),
expires INTEGER,
username VARCHAR(64) REFERENCES Users(username),
PRIMARY KEY(code)");
......
......@@ -21,7 +21,7 @@
require_once('database.php'); // include the database connection string
function usernameFromSID($session_id)
function usernameFromSID($session_id)
{
//derive the username from a session ID
......@@ -198,7 +198,7 @@ function NoSpamTracks ($track) {
$track = str_replace(' (PREVIEW: buy it at www.magnatune.com)', "", $track);
return $track;
}
function getAlbumArt($artist, $album) {
......
......@@ -25,9 +25,9 @@
function human_timestamp ($unix_timestamp, $now = null) {
if (is_null($now)) {
$now = time();
$now = time();
}
$diff = $now - $unix_timestamp;
# ugly!
......
<?php
<?php
/* Libre.fm -- a free network service for sharing your music listening habits
......
......@@ -34,7 +34,7 @@ class ArtistXML {
*/
public static function getInfo($artistName, $api_key=false, $mbid=false, $lang='en') {
// We assume $api_key is valid and set at this point
if (!isset($artistName) && !isset($mbid)) {
echo XML::error('failed', '7', 'Invalid resource specified');
return;
......@@ -42,7 +42,7 @@ class ArtistXML {
$artist = new Artist($artistName, $mbid);
if (PEAR::isError($artist)) {
if (PEAR::isError($artist)) {
return(XML::error('failed', '7', 'Invalid resource specified'));
}
......@@ -86,7 +86,7 @@ class ArtistXML {
$track->addChild('listeners', $tracks[$i]->getListenerCount());
}
return($xml);
return($xml);
}
}
......
......@@ -28,11 +28,11 @@ require_once('config.php');
require_once('adodb/adodb-exceptions.inc.php');
require_once('adodb/adodb.inc.php');
try {
try {
$adodb =& NewADOConnection($adodb_connect_string);
} catch (exception $e) {
var_dump($e);
} catch (exception $e) {
var_dump($e);
adodb_backtrace($e->gettrace());
}
}
?>
......@@ -72,7 +72,7 @@ if(isset($group->name)) {
if (!PEAR::isError ($aUserTagCloud)) {
$smarty->assign('group_tagcloud',$aUserTagCloud);
}
$smarty->assign('userlist', $group->getUsers());
$smarty->assign('ismember', $group->memberCheck($this_user));
......@@ -90,7 +90,7 @@ if(isset($group->name)) {
'href' => $base_url.'/rdf.php?fmt=xml&page='.urlencode(str_replace($base_url, '', $_SERVER['REQUEST_URI']))
)
));
$smarty->assign('profile', true);
$smarty->display('group.tpl');
......
......@@ -61,7 +61,7 @@ if (isset($_POST['install'])) {
if(!$result) {
$print_config = str_replace('<', '&lt;', $config);
die('Unable to write to file \'<i>config.php</i>\'. Please create this file and copy the following in to it: <br /><pre>' . $print_config . '</pre>');
}
}
die('Configuration completed successfully!');
}
......@@ -106,7 +106,7 @@ if (isset($_POST['install'])) {
<br />
<h2>General</h2>
Default Theme: <select name="default_theme">
<?php
<?php
$dir = opendir('themes');
while($theme = readdir($dir)) {
if(is_dir('themes/' . $theme) && $theme[0] != '.') {
......
......@@ -31,20 +31,20 @@ elseif ( strtolower(substr($mdb2->phptype, 0, 5)) == 'mssql' )
$random = 'NEWID'; // I don't think we try to support MSSQL, but here's how it's done theoretically anyway
else
$random = 'RANDOM'; // postgresql, sqlite, possibly others
if ($_REQUEST['country'])
{
$q = sprintf('SELECT u.* FROM Users u INNER JOIN Places p ON u.location_uri=p.location_uri AND p.country=%s ORDER BY %s() LIMIT 100',
$mdb2->quote(strtoupper($_REQUEST['country']), 'text'),
$random);
$res = $mdb2->query($q);
while ( $row = $res->fetchRow(MDB2_FETCHMODE_ASSOC) )
{
$userlist[] = new User($row['username'], $row);
$userlist[] = new User($row['username'], $row);
}
$smarty->assign('country', strtoupper($_REQUEST['country']));
$res = $mdb2->query(sprintf('SELECT * FROM Countries WHERE country=%s LIMIT 1',
$mdb2->quote(strtoupper($_REQUEST['country']), 'text')));
......@@ -52,9 +52,9 @@ if ($_REQUEST['country'])
{
$smarty->assign('country_info', $row);
}
$smarty->assign('userlist', $userlist);
$smarty->assign('extra_head_links', array(
array(
'rel' => 'meta',
......@@ -63,7 +63,7 @@ if ($_REQUEST['country'])
'href' => $base_url.'/rdf.php?fmt=xml&page='.urlencode(str_replace($base_url, '', $_SERVER['REQUEST_URI']))
)
));
$smarty->display('location-country.tpl');
}
......
......@@ -63,7 +63,7 @@ switch ($fmt)
case 'json' :
if ($_GET['callback'])
{ header('Content-Type: text/javascript'); }
else
else
{ header('Content-Type: application/json'); }
$ser = ARC2::getRDFJSONSerializer($conf);
break;
......@@ -80,4 +80,4 @@ print $ser->getSerializedIndex($index);
if ($_GET['callback']) {
print ');';
}
......@@ -44,10 +44,10 @@ if (isset($_GET['code'])) {
}
$row = $res->fetchRow(MDB2_FETCHMODE_ASSOC);
$password = '';
$chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
for ($i = 0; $i < 8; $i++) {
$password .= substr($chars, mt_rand(0, strlen($chars)-1), 1);
}
......@@ -70,14 +70,14 @@ else if (isset($_POST['user'])) {
$username = $_POST['user'];
$res = $mdb2->query('SELECT * FROM Users WHERE username="'
. $mdb2->quote($username, 'text'));
. $mdb2->quote($username, 'text'));
if (PEAR::isError($res) || $res->numRows() == 0) {
$errors .= "User not found.\n";
$smarty->assign('errors', $errors);
$smarty->display('error.tpl');
die();
}
}
$row = $res->fetchRow(MDB2_FETCHMODE_ASSOC);
$code = md5($username . $row['email'] . time());
$sql = 'INSERT INTO Recovery_Request (username, email, code, expires) VALUES('
......@@ -95,12 +95,12 @@ else if (isset($_POST['user'])) {
}
$url = $base_url . '/reset.php?code=' . $code;
$content = "Hi!\n\nSomeone from the IP-address " . $_SERVER['REMOTE_ADDR'] . " entered your username "
$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);
}
$smarty->assign('sent', true);
}
$smarty->display('reset.tpl');
?>
......@@ -39,7 +39,7 @@ if($_GET['lang']) {
$lcomponents = preg_split('/-/', $languages[$i]);
$languages[$i] = $lcomponents[0] . '_' . strtoupper($lcomponents[1]);
}
$languages[$i] = $languages[$i] . '.UTF-8';
}
}
......@@ -59,7 +59,7 @@ $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_absolute',
(empty($_SERVER['HTTPS']) ? 'http://' : 'http://')
(empty($_SERVER['HTTPS']) ? 'http://' : 'http://')
.(empty($_SERVER['HOST']) ? $_SERVER['SERVER_NAME'] : $_SERVER['HOST'])
.(($_SERVER['SERVER_PORT']==80) ? '' : (':'.$_SERVER['SERVER_PORT']))
. $_SERVER['REQUEST_URI']);
......
......@@ -113,10 +113,10 @@ if ($_POST['submit'])
$this_user->avatar_uri = $_POST['avatar_uri'];
$this_user->laconica_profile = $_POST['laconica_profile'];
$this_user->journal_rss = $_POST['journal_rss'];
if (!empty( $_POST['password_1'] ))
$user->password = md5($_POST['password_1']);
$this_user->save();
header('Location: ' . $this_user->getURL());
......@@ -140,10 +140,10 @@ if(isset($this_user->name))
# Stuff which cannot be changed *here*
$smarty->assign('userlevel', $this_user->userlevel);
# Stuff which cannot be changed *yet*
$smarty->assign('email', $this_user->email);
if ($_POST['submit'])
{
$smarty->assign('id', $_POST['id']);
......
......@@ -46,7 +46,7 @@ if(isset($user->name)) {
$smarty->assign('isme', ($_SESSION['user']->name == $user->name));
$smarty->assign('me', $user);
$smarty->assign('profile', true);
$smarty->assign('groups', Group::groupList($user));
$smarty->assign('extra_head_links', array(
......@@ -57,7 +57,7 @@ if(isset($user->name)) {
'href' => $base_url.'/rdf.php?fmt=xml&page='.urlencode(str_replace($base_url, '', $user->getURL('groups')))
)
));
$smarty->display('user-groups.tpl');
} else {
$smarty->assign('error', 'User not found');
......
......@@ -90,4 +90,4 @@ $smarty->assign('extra_head_links', array(
)
));
$smarty->display('user-journal.tpl');
......@@ -53,7 +53,7 @@ if(isset($user->name)) {
$smarty->assign('me', $user);
$smarty->assign('sidebar', true);
$smarty->assign('sidebartemplate', 'profile-sidebar.tpl');
$smarty->assign('extra_head_links', array(
array(
'rel'=>'alternate',
......@@ -74,7 +74,7 @@ if(isset($user->name)) {
'href' => $base_url.'/rdf.php?fmt=xml&page='.urlencode(str_replace($base_url, '', $user->getURL()))
)
));
$smarty->display('user-profile.tpl');
} else {
$smarty->assign('error', 'User not found');
......
......@@ -53,7 +53,7 @@ if(isset($user->name)) {
$smarty->assign('isme', ($this_user->name == $user->name));
$smarty->assign('me', $user);
$smarty->assign('profile', true);
$smarty->assign('extra_head_links', array(
array(
'rel'=>'alternate',
......
......@@ -40,20 +40,20 @@ if(isset($user->name)) {
# if (!PEAR::isError ($aUserTagCloud)) {
# $smarty->assign('user_tagcloud',$aUserTagCloud);
# }
$smarty->assign('stat_barwidth', 320);
$aUserPlayStat = Statistic::GeneratePlayStats('Scrobbles', 'artist', 40, $user->name, 300);
if (!PEAR::isError ($aUserPlayStat)) {
$smarty->assign('user_playstats',$aUserPlayStat);
}
$aUserDayStat = Statistic::generatePlayByDays('Scrobbles', 40, $user->name, 300);
if (!PEAR::isError ($aUserDayStat)) {
$smarty->assign('user_daystats',$aUserDayStat);
}
$smarty->assign('toptracks', $user->getTopTracks(40));
$smarty->assign('me', $user);
$smarty->assign('geo', Server::getLocationDetails($user->location_uri));
$smarty->assign('isme', ($this_user->name == $user->name));
......@@ -66,7 +66,7 @@ if(isset($user->name)) {
'href' => $base_url.'/rdf.php?fmt=xml&page='.urlencode(str_replace($base_url, '', $user->getURL()))
)
));
$smarty->assign('stats', true);
$smarty->display('user-stats.tpl');
} else {
......
......@@ -15,7 +15,7 @@ class ARC2_DcExtractor extends ARC2_RDFExtractor {
function __construct($a = '', &$caller) {
parent::__construct($a, $caller);
}
function ARC2_DcExtractor($a = '', &$caller) {
$this->__construct($a, $caller);
}
......@@ -26,7 +26,7 @@ class ARC2_DcExtractor extends ARC2_RDFExtractor {
}
/* */
function extractRDF() {
$t_vals = array();
$t = '';
......@@ -43,7 +43,7 @@ class ARC2_DcExtractor extends ARC2_RDFExtractor {
$this->addTs(ARC2::getTriplesFromIndex($doc));
}
}
/* */
function extractTitle($n, $t_vals, $t) {
......@@ -52,7 +52,7 @@ class ARC2_DcExtractor extends ARC2_RDFExtractor {
}
return array($t_vals, $t);
}
/* */
function extractLink($n, $t_vals, $t) {
......@@ -69,7 +69,7 @@ class ARC2_DcExtractor extends ARC2_RDFExtractor {
}
return array($t_vals, $t);
}
function extractMeta($n, $t_vals, $t) {
if ($this->hasAttribute('http-equiv', $n, 'Content-Type') || $this->hasAttribute('http-equiv', $n, 'content-type')) {
if ($v = $this->v('content', '', $n['a'])) {
......@@ -78,7 +78,7 @@ class ARC2_DcExtractor extends ARC2_RDFExtractor {
}
return array($t_vals, $t);
}
/* */
}
......@@ -15,7 +15,7 @@ class ARC2_ErdfExtractor extends ARC2_RDFExtractor {
function __construct($a = '', &$caller) {
parent::__construct($a, $caller);
}
function ARC2_ErdfExtractor($a = '', &$caller) {
$this->__construct($a, $caller);
}
......@@ -25,7 +25,7 @@ class ARC2_ErdfExtractor extends ARC2_RDFExtractor {
}
/* */
function extractRDF() {
if (!isset($this->caller->detected_formats['erdf'])) return 0;
$root_node = $this->getRootNode();
......@@ -40,9 +40,9 @@ class ARC2_ErdfExtractor extends ARC2_RDFExtractor {
);
$this->processNode($root_node, $context);
}
/* */
function getRootNode() {
foreach ($this->nodes as $id => $node) {
if ($node['tag'] == 'html') {
......@@ -51,7 +51,7 @@ class ARC2_ErdfExtractor extends ARC2_RDFExtractor {
}
return $this->nodes[0];
}
function getNamespaces() {
$r = array(
'rdf' => 'http://www.w3.org/1999/02/22-rdf-syntax-ns#',
......@@ -66,7 +66,7 @@ class ARC2_ErdfExtractor extends ARC2_RDFExtractor {
}
/* */
function processNode($n, $ct) {
/* context */
//$ct['lang'] = $this->v('xml:lang', $ct['lang'], $n['a']);
......@@ -85,7 +85,7 @@ class ARC2_ErdfExtractor extends ARC2_RDFExtractor {
$t = array(
's' => $ct['cur_res'],
's_type' => 'uri',
'p' => $uri,
'p' => $uri,
'o' => $ct['cur_obj_literal']['value'],
'o_type' => 'literal',
'o_lang' => $ct['cur_obj_literal']['datatype'] ? '' : $ct['cur_obj_literal']['lang'],
......@@ -101,7 +101,7 @@ class ARC2_ErdfExtractor extends ARC2_RDFExtractor {
$t = array(
's' => $s,
's_type' => 'uri',
'p' => $ct['ns']['rdf'] . 'type',
'p' => $ct['ns']['rdf'] . 'type',
'o' => trim($uri),
'o_type' => 'uri',
'o_lang' => '',
......@@ -112,7 +112,7 @@ class ARC2_ErdfExtractor extends ARC2_RDFExtractor {
$t = array(
's' => $ct['prev_res'],
's_type' => 'uri',
'p' => $uri,
'p' => $uri,
'o' => $ct['cur_res'],
'o_type' => 'uri',
'o_lang' => '',
......@@ -123,7 +123,7 @@ class ARC2_ErdfExtractor extends ARC2_RDFExtractor {
$t = array(
's' => $ct['cur_res'],
's_type' => 'uri',
'p' => $uri,
'p' => $uri,
'o' => $ct['cur_obj_literal']['value'],
'o_type' => 'literal',
'o_lang' => $ct['cur_obj_literal']['datatype'] ? '' : $ct['cur_obj_literal']['lang'],
......@@ -146,7 +146,7 @@ class ARC2_ErdfExtractor extends ARC2_RDFExtractor {
$t = array(
's' => $ct['cur_res'],
's_type' => 'uri',
'p' => $uri,
'p' => $uri,
'o' => $o,
'o_type' => 'uri',
'o_lang' => '',
......@@ -161,7 +161,7 @@ class ARC2_ErdfExtractor extends ARC2_RDFExtractor {
$t = array(
's' => $s,
's_type' => 'uri',
'p' => $uri,
'p' => $uri,
'o' => $ct['cur_res'],
'o_type' => 'uri',
'o_lang' => '',
......@@ -178,7 +178,7 @@ class ARC2_ErdfExtractor extends ARC2_RDFExtractor {
$t = array(
's' => $s,
's_type' => 'uri',
'p' => $ct['ns']['rdfs'] . 'label',
'p' => $ct['ns']['rdfs'] . 'label',
'o' => $ct['cur_obj_literal']['value'],
'o_type' => 'literal',
'o_lang' => $ct['cur_obj_literal']['datatype'] ? '' : $ct['cur_obj_literal']['lang'],
......@@ -193,7 +193,7 @@ class ARC2_ErdfExtractor extends ARC2_RDFExtractor {
$t = array(
's' => $s,
's_type' => 'uri',
'p' => $ct['ns']['rdfs'] . 'label',
'p' => $ct['ns']['rdfs'] . 'label',
'o' => $ct['cur_obj_literal']['value'],
'o_type' => 'literal',
'o_lang' => $ct['cur_obj_literal']['datatype'] ? '' : $ct['cur_obj_literal']['lang'],
......@@ -213,7 +213,7 @@ class ARC2_ErdfExtractor extends ARC2_RDFExtractor {
}
/* */
function getPropertyURIs($n, $ct) {
$r = array();
foreach (array('rel', 'rev', 'class', 'name', 'src') as $type) {
......@@ -237,7 +237,7 @@ class ARC2_ErdfExtractor extends ARC2_RDFExtractor {
}
return $ct['cur_res'];
}
function getCurrentObjectID($n, $ct) {
foreach (array('href', 'src') as $a) {
if (isset($n['a'][$a])) {
......@@ -261,9 +261,9 @@ class ARC2_ErdfExtractor extends ARC2_RDFExtractor {
}
return $r;
}
/* */
function xURI($v, $base, $ns, $attr_type = '') {
if ((list($sub_r, $sub_v) = $this->xQname($v, $base, $ns)) && $sub_r) {
return array($sub_r, $sub_v);
......@@ -273,7 +273,7 @@ class ARC2_ErdfExtractor extends ARC2_RDFExtractor {
}
return array($this->calcURI($v, $base), '');
}
function xQname($v, $base, $ns) {
if ($sub_r = $this->x('([a-z0-9\-\_]+)[\-\.]([a-z0-9\-\_]+)', $v)) {
if (isset($ns[$sub_r[1]])) {
......@@ -282,7 +282,7 @@ class ARC2_ErdfExtractor extends ARC2_RDFExtractor {
}
return array(0, $v);
}
/* */
}
......@@ -15,7 +15,7 @@ class ARC2_OpenidExtractor extends ARC2_RDFExtractor {
function __construct($a = '', &$caller) {
parent::__construct($a, $caller);
}
function ARC2_OpenidExtractor($a = '', &$caller) {
$this->__construct($a, $caller);
}
......@@ -26,7 +26,7 @@ class ARC2_OpenidExtractor extends ARC2_RDFExtractor {
}
/* */
function extractRDF() {
$t_vals = array();
$t = '';
......@@ -41,7 +41,7 @@ class ARC2_OpenidExtractor extends ARC2_RDFExtractor {
$this->addTs(ARC2::getTriplesFromIndex($doc));
}
}
/* */
function extractLink($n, $t_vals, $t) {
......@@ -60,7 +60,7 @@ class ARC2_OpenidExtractor extends ARC2_RDFExtractor {
}
return array($t_vals, $t);
}
/* */
}
......@@ -15,7 +15,7 @@ class ARC2_TwitterProfilePicExtractor extends ARC2_RDFExtractor {
function __construct($a = '', &$caller) {
parent::__construct($a, $caller);
}
function ARC2_TwitterProfilePicExtractor($a = '', &$caller) {
$this->__construct($a, $caller);
}
......@@ -27,7 +27,7 @@ class ARC2_TwitterProfilePicExtractor extends ARC2_RDFExtractor {
}
/* */
function extractRDF() {
$t_vals = array();
$t = '';
......@@ -45,5 +45,5 @@ class ARC2_TwitterProfilePicExtractor extends ARC2_RDFExtractor {
}
/* */
}
......@@ -15,7 +15,7 @@ class ARC2_StoreDescribeQueryHandler extends ARC2_StoreSelectQueryHandler {
function __construct($a = '', &$caller) {/* caller has to be a store */
parent::__construct($a, $caller);
}
function ARC2_StoreDescribeQueryHandler($a = '', &$caller) {
$this->__construct($a, $caller);
}
......@@ -27,7 +27,7 @@ class ARC2_StoreDescribeQueryHandler extends ARC2_StoreSelectQueryHandler {
}
/* */
function runQuery($infos) {
$ids = $infos['query']['result_uris'];
if ($vars = $infos['query']['result_vars']) {
......@@ -56,24 +56,24 @@ class ARC2_StoreDescribeQueryHandler extends ARC2_StoreSelectQueryHandler {
$this->described_ids[] = $id;
if ($this->detect_labels) {
$q = '
CONSTRUCT {
<' . $id . '> ?p ?o .
?o ?label_p ?o_label .
CONSTRUCT {
<' . $id . '> ?p ?o .
?o ?label_p ?o_label .
?o <http://arc.semsol.org/ns/arc#label> ?o_label .
} WHERE {
} WHERE {
<' . $id . '> ?p ?o .
OPTIONAL {
?o ?label_p ?o_label .
FILTER REGEX(str(?label_p), "(name|label|title|summary|nick|fn)$", "i")
FILTER REGEX(str(?label_p), "(name|label|title|summary|nick|fn)$", "i")
}
}
';
}
else {
$q = '
CONSTRUCT {
<' . $id . '> ?p ?o .
} WHERE {
CONSTRUCT {
<' . $id . '> ?p ?o .
} WHERE {
<' . $id . '> ?p ?o .
}
';