[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Librefm-commits] [1474] Fix some more space indentation
From: |
Michael Sheldon |
Subject: |
[Librefm-commits] [1474] Fix some more space indentation |
Date: |
Sun, 10 May 2009 20:21:57 +0000 |
Revision: 1474
http://svn.sv.gnu.org/viewvc/?view=rev&root=librefm&revision=1474
Author: elleo
Date: 2009-05-10 20:21:55 +0000 (Sun, 10 May 2009)
Log Message:
-----------
Fix some more space indentation
Change more quoting to match coding standards
Modified Paths:
--------------
trunk/nixtape/admin.php
trunk/nixtape/album.php
trunk/nixtape/artist.php
trunk/nixtape/data/TagCloud.php
trunk/nixtape/database.php
trunk/nixtape/database2.php
trunk/nixtape/delete-profile.php
trunk/nixtape/edit_group.php
trunk/nixtape/explore.php
trunk/nixtape/group.php
trunk/nixtape/index.php
trunk/nixtape/install.php
trunk/nixtape/invite.php
trunk/nixtape/licenses.php
trunk/nixtape/listen.php
trunk/nixtape/location.php
trunk/nixtape/login.php
trunk/nixtape/rdf.php
trunk/nixtape/recovery.php
trunk/nixtape/register.php
trunk/nixtape/resolve-external.php
trunk/nixtape/scrobble-proxy.php
trunk/nixtape/templating.php
trunk/nixtape/track.php
trunk/nixtape/user-edit.php
Modified: trunk/nixtape/admin.php
===================================================================
--- trunk/nixtape/admin.php 2009-05-10 15:07:40 UTC (rev 1473)
+++ trunk/nixtape/admin.php 2009-05-10 20:21:55 UTC (rev 1474)
@@ -28,65 +28,65 @@
$userlevel = $u_user->userlevel;
function sendEmail($email) {
- global $mdb2;
- global $base_url;
- global $u_user;
- $username = $u_user->name;
- $code = md5(md5($username) . time());
+ global $mdb2;
+ global $base_url;
+ global $u_user;
+ $username = $u_user->name;
+ $code = md5(md5($username) . time());
- // Insert the invitation into the table
- $sql = 'INSERT INTO Invitations (inviter, code) VALUES ('
- . $mdb2->quote($username, 'text') . ', '
- . $mdb2->quote($code, 'text') . ')';
+ // Insert the invitation into the table
+ $sql = 'INSERT INTO Invitations (inviter, code) VALUES ('
+ . $mdb2->quote($username, 'text') . ', '
+ . $mdb2->quote($code, 'text') . ')';
+
+ $affected =& $mdb2->exec($sql);
+
+ if (PEAR::isError($affected)) {
+ die($affected->getMessage());
+ }
- $affected =& $mdb2->exec($sql);
-
- if (PEAR::isError($affected)) {
- die($affected->getMessage());
- }
-
- $url = $base_url . '/register.php?authcode=' . $code;
- $headers = 'From: Libre.fm Invitations <address@hidden>';
- $subject = 'Libre.fm Invitation';
- $body = 'Hi!' . "\n\n" . 'You requested an invite to libre.fm, and here it
is! Just click the link and fill in your details.';
- $body .= "\n\n" . $url;
- $body .= "\n\n - The Libre.fm Team";
- mail($email, $subject, $body, $headers);
- unset($url, $subject, $body, $headers);
+ $url = $base_url . '/register.php?authcode=' . $code;
+ $headers = 'From: Libre.fm Invitations <address@hidden>';
+ $subject = 'Libre.fm Invitation';
+ $body = 'Hi!' . "\n\n" . 'You requested an invite to libre.fm, and here
it is! Just click the link and fill in your details.';
+ $body .= "\n\n" . $url;
+ $body .= "\n\n - The Libre.fm Team";
+ mail($email, $subject, $body, $headers);
+ unset($url, $subject, $body, $headers);
}
-if ($userlevel < 2) {
- $smarty->assign("error", "Error!");
- $smarty->assign("details", "Invalid privileges.");
- $smarty->display("error.tpl");
- die();
+if ($userlevel < 2) {
+ $smarty->assign('error', 'Error!');
+ $smarty->assign('details', 'Invalid privileges.');
+ $smarty->display('error.tpl');
+ die();
} else {
- $action = $_GET['action'];
- if (isset($action)) {
- if ($action == "invite") {
- if (!isset($_GET['email'])) {
- $smarty->assign("error", "Error!");
- $smarty->assign("details", "Missing email.");
- $smarty->display("error.tpl");
- die();
- } else {
- // Send the email
- sendEmail($_GET['email']);
- $smarty->assign('sent', true);
- $sql = "UPDATE Invitation_Request SET status=1 WHERE email=" .
$mdb2->quote($_GET['email'], 'text');
- $mdb2->exec($sql);
- }
- } else {
- $smarty->assign('error', "Error!");
- $smarty->assign('error', 'Missing argument!');
- $smarty->display('error.tpl');
- die();
+ $action = $_GET['action'];
+ if (isset($action)) {
+ if ($action == 'invite') {
+ if (!isset($_GET['email'])) {
+ $smarty->assign('error', 'Error!');
+ $smarty->assign('details', 'Missing email.');
+ $smarty->display('error.tpl');
+ die();
+ } else {
+ // Send the email
+ sendEmail($_GET['email']);
+ $smarty->assign('sent', true);
+ $sql = 'UPDATE Invitation_Request SET status=1
WHERE email=' . $mdb2->quote($_GET['email'], 'text');
+ $mdb2->exec($sql);
+ }
+ } else {
+ $smarty->assign('error', 'Error!');
+ $smarty->assign('error', 'Missing argument!');
+ $smarty->display('error.tpl');
+ die();
+ }
}
- }
-
+
}
-$res = $mdb2->query("SELECT email,status FROM Invitation_Request ORDER BY time
ASC");
+$res = $mdb2->query('SELECT email,status FROM Invitation_Request ORDER BY time
ASC');
$data = $res->fetchAll(MDB2_FETCHMODE_ASSOC);
$smarty->assign('emails', $data);
$smarty->display('admin.tpl');
Modified: trunk/nixtape/album.php
===================================================================
--- trunk/nixtape/album.php 2009-05-10 15:07:40 UTC (rev 1473)
+++ trunk/nixtape/album.php 2009-05-10 20:21:55 UTC (rev 1474)
@@ -20,20 +20,20 @@
*/
-require_once("database.php");
-require_once("templating.php");
-require_once("data/Album.php");
+require_once('database.php');
+require_once('templating.php');
+require_once('data/Album.php');
$album = new Album(urldecode($_GET['album']), urldecode($_GET['artist']));
$artist = new Artist($album->artist_name);
-$smarty->assign("name", $album->name);
-$smarty->assign("id", $album->id);
-$smarty->assign("artist", $artist);
-$smarty->assign("album", $album);
+$smarty->assign('name', $album->name);
+$smarty->assign('id', $album->id);
+$smarty->assign('artist', $artist);
+$smarty->assign('album', $album);
$aAlbumTracks = $album->getTracks();
if (!PEAR::isError($aAlbumTracks )) {
- $smarty->assign("tracks", $aAlbumTracks);
+ $smarty->assign('tracks', $aAlbumTracks);
}
$smarty->assign('extra_head_links', array(
@@ -45,7 +45,7 @@
)
));
-$smarty->display("album.tpl");
+$smarty->display('album.tpl');
?>
Modified: trunk/nixtape/artist.php
===================================================================
--- trunk/nixtape/artist.php 2009-05-10 15:07:40 UTC (rev 1473)
+++ trunk/nixtape/artist.php 2009-05-10 20:21:55 UTC (rev 1474)
@@ -28,9 +28,9 @@
$artist = new Artist(urldecode($_GET['artist']));
-$smarty->assign("name", $artist->name);
-$smarty->assign("id", $artist->id);
-$smarty->assign("bio_summary", $artist->bio_summary);
+$smarty->assign('name', $artist->name);
+$smarty->assign('id', $artist->id);
+$smarty->assign('bio_summary', $artist->bio_summary);
$aTagCloud = TagCloud::GenerateTagCloud(TagCloud::scrobblesTable(), 'artist');
if (!PEAR::isError ($aTagCloud)) {
@@ -39,7 +39,7 @@
$aArtistAlbums = $artist->getAlbums();
if (!PEAR::isError($aArtistAlbums)) {
- $smarty->assign("albums", $aArtistAlbums);
+ $smarty->assign('albums', $aArtistAlbums);
}
$smarty->assign('extra_head_links', array(
Modified: trunk/nixtape/data/TagCloud.php
===================================================================
--- trunk/nixtape/data/TagCloud.php 2009-05-10 15:07:40 UTC (rev 1473)
+++ trunk/nixtape/data/TagCloud.php 2009-05-10 20:21:55 UTC (rev 1474)
@@ -53,7 +53,7 @@
$adodb->SetFetchMode(ADODB_FETCH_ASSOC);
$res = $adodb->CacheGetAll(7200,$query);
if (!$res) {
- echo('ERROR $query');
+ echo('ERROR ' . $query);
} else {
foreach($res as $count => &$i) {
$i['size'] = $sizes[(int)
($count/(count($res)/7))];
Modified: trunk/nixtape/database.php
===================================================================
--- trunk/nixtape/database.php 2009-05-10 15:07:40 UTC (rev 1473)
+++ trunk/nixtape/database.php 2009-05-10 20:21:55 UTC (rev 1474)
@@ -20,8 +20,8 @@
*/
-if(!file_exists(dirname(__FILE__) . "/config.php")) {
- die("Please run the <a href='install.php'>Install</a> script to
configure your installation");
+if(!file_exists(dirname(__FILE__) . '/config.php')) {
+ die('Please run the <a href=\'install.php\'>Install</a> script to
configure your installation');
}
require_once('config.php');
@@ -33,15 +33,15 @@
}
function reportError($text, $data) {
- // make a fresh connection
- $mdbe = MDB2::connect($connect_string);
- if (PEAR::isError($mdbe)) {
- die($mdbe->getMessage());
- }
-
- $mdbe->exec("INSERT INTO Error (msg, data, time) VALUES ("
- . $mdbe->quote($text, 'text') . ", "
- . $mdbe->quote($data, 'text') . ", "
- . time() . ")");
+ // make a fresh connection
+ $mdbe = MDB2::connect($connect_string);
+ if (PEAR::isError($mdbe)) {
+ die($mdbe->getMessage());
+ }
+
+ $mdbe->exec('INSERT INTO Error (msg, data, time) VALUES ('
+ . $mdbe->quote($text, 'text') . ', '
+ . $mdbe->quote($data, 'text') . ', '
+ . time() . ')');
}
?>
Modified: trunk/nixtape/database2.php
===================================================================
--- trunk/nixtape/database2.php 2009-05-10 15:07:40 UTC (rev 1473)
+++ trunk/nixtape/database2.php 2009-05-10 20:21:55 UTC (rev 1474)
@@ -20,8 +20,8 @@
*/
-if(!file_exists(dirname(__FILE__) . "/config.php")) {
- die("Please run the <a href='install.php'>Install</a> script to
configure your installation");
+if(!file_exists(dirname(__FILE__) . '/config.php')) {
+ die('Please run the <a href=\'install.php\'>Install</a> script to
configure your installation');
}
require_once('config.php');
Modified: trunk/nixtape/delete-profile.php
===================================================================
--- trunk/nixtape/delete-profile.php 2009-05-10 15:07:40 UTC (rev 1473)
+++ trunk/nixtape/delete-profile.php 2009-05-10 20:21:55 UTC (rev 1474)
@@ -1,32 +1,39 @@
<?php
+
/* Libre.fm -- a free network service for sharing your music listening habits
- Copyright (C) 2009 Libre.fm Project
- 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');
+
+ Copyright (C) 2009 Libre.fm Project
+
+ 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 ('templating.php');
require_once ('data/User.php');
require_once ('utils/random_code_generator.php');
+
if ($logged_in == false) {
$smarty->assign('error', 'Error!');
$smarty->assign('details', 'Not logged in! You shouldn\'t be here!');
$smarty->display('error.tpl');
die ();
} elseif ( isset ($_GET['code'])) {
- $mdb2->exec("DELETE FROM Delete_Request WHERE expires < " .
$mdb2->quote(time(), "integer"));
+ $mdb2->exec('DELETE FROM Delete_Request WHERE expires < ' .
$mdb2->quote(time(), 'integer'));
$username = $this_user->name;
$code = $_GET['code'];
- $res = $mdb2->query("SELECT * FROM Delete_Request WHERE username =
".$mdb2->quote($username, 'text').' AND code = '.$mdb2->quote($code, 'text'));
+ $res = $mdb2->query('SELECT * FROM Delete_Request WHERE username = ' .
$mdb2->quote($username, 'text') . ' AND code = ' . $mdb2->quote($code, 'text'));
if (PEAR::isError($res)) {
//($res);
exit ;
@@ -38,29 +45,29 @@
$smarty->display('error.tpl');
die ();
} else {
- $mdb2->exec("DELETE FROM Scrobble_Sessions WHERE username =
".$mdb2->quote($username, 'text'));
- $mdb2->exec("DELETE FROM Delete_Request WHERE username =
".$mdb2->quote($username, 'text'));
- $mdb2->exec("DELETE FROM Auth WHERE username =
".$mdb2->quote($username, 'text'));
- $mdb2->exec("DELETE FROM Group_Members WHERE member =
".$mdb2->quote($this_user->uniqueid, 'integer'));
- $mdb2->exec("DELETE FROM Radio_Sessions WHERE username =
".$mdb2->quote($username, 'text'));
- $mdb2->exec("DELETE FROM Recovery_Request WHERE username =
".$mdb2->quote($username, 'text'));
- $mdb2->exec("DELETE FROM Scrobbles WHERE username =
".$mdb2->quote($username, 'text'));
- $mdb2->exec("DELETE FROM User_Relationship_Flags WHERE uid1 =
".$mdb2->quote($this_user->uniqueid, 'integer'));
- $mdb2->exec("DELETE FROM User_Relationship_Flags WHERE uid2 =
".$mdb2->quote($this_user->uniqueid, 'integer'));
- $mdb2->exec("DELETE FROM User_Relationships WHERE uid1 =
".$mdb2->quote($this_user->uniqueid, 'integer'));
- $mdb2->exec("DELETE FROM User_Relationships WHERE uid2 =
".$mdb2->quote($this_user->uniqueid, 'integer'));
- $mdb2->exec("DELETE FROM Users WHERE lower(username) =
".$mdb2->quote(strtolower($username), 'text'));
+ $mdb2->exec('DELETE FROM Scrobble_Sessions WHERE username = ' .
$mdb2->quote($username, 'text'));
+ $mdb2->exec('DELETE FROM Delete_Request WHERE username = ' .
$mdb2->quote($username, 'text'));
+ $mdb2->exec('DELETE FROM Auth WHERE username = ' .
$mdb2->quote($username, 'text'));
+ $mdb2->exec('DELETE FROM Group_Members WHERE member = ' .
$mdb2->quote($this_user->uniqueid, 'integer'));
+ $mdb2->exec('DELETE FROM Radio_Sessions WHERE username = ' .
$mdb2->quote($username, 'text'));
+ $mdb2->exec('DELETE FROM Recovery_Request WHERE username = ' .
$mdb2->quote($username, 'text'));
+ $mdb2->exec('DELETE FROM Scrobbles WHERE username = ' .
$mdb2->quote($username, 'text'));
+ $mdb2->exec('DELETE FROM User_Relationship_Flags WHERE uid1 = '
. $mdb2->quote($this_user->uniqueid, 'integer'));
+ $mdb2->exec('DELETE FROM User_Relationship_Flags WHERE uid2 = '
. $mdb2->quote($this_user->uniqueid, 'integer'));
+ $mdb2->exec('DELETE FROM User_Relationships WHERE uid1 = ' .
$mdb2->quote($this_user->uniqueid, 'integer'));
+ $mdb2->exec('DELETE FROM User_Relationships WHERE uid2 = ' .
$mdb2->quote($this_user->uniqueid, 'integer'));
+ $mdb2->exec('DELETE FROM Users WHERE lower(username) = ' .
$mdb2->quote(strtolower($username), 'text'));
session_destroy();
- header("Location: index.php");
+ header('Location: index.php');
}
} else {
$code = generateCode();
$username = $this_user->name;
$email = $this_user->email;
$expire = time()+86400;
- $mdb2->exec("INSERT INTO Delete_Request (code, expires, username)
VALUES (".$mdb2->quote($code, 'text').', '.$mdb2->quote($expire,
'text').",".$mdb2->quote($username, 'text').')');
- $url = $base_url."/delete-profile.php?code=".$code;
- $content = "Hi!\n\nSomeone from the IP address
".$_SERVER['REMOTE_ADDR']." requested account deletion @ libre.fm. To remove
this account click: \n\n".$url."\n\n- The Libre.fm Team";
+ $mdb2->exec('INSERT INTO Delete_Request (code, expires, username)
VALUES (' . $mdb2->quote($code, 'text') . ', ' . $mdb2->quote($expire, 'text')
. "," . $mdb2->quote($username, 'text') . ')');
+ $url = $base_url . '/delete-profile.php?code=' . $code;
+ $content = "Hi!\n\nSomeone from the IP address " .
$_SERVER['REMOTE_ADDR'] . " requested account deletion at libre.fm. To remove
this account click: \n\n" . $url . "\n\n- The Libre.fm Team";
$headers = 'From: Libre.fm <address@hidden>';
$subject = 'Libre.fm Account Delete Request - Action needed!';
mail($email, $subject, $content, $headers);
Modified: trunk/nixtape/edit_group.php
===================================================================
--- trunk/nixtape/edit_group.php 2009-05-10 15:07:40 UTC (rev 1473)
+++ trunk/nixtape/edit_group.php 2009-05-10 20:21:55 UTC (rev 1474)
@@ -41,7 +41,7 @@
if ($result instanceof Group)
{
- header("Location:
{$base_url}/edit_group.php?group=".$_REQUEST['new']);
+ header('Location: ' . $base_url .
'/edit_group.php?group=' . $_REQUEST['new']);
exit();
}
elseif (PEAR::isError($result))
@@ -84,9 +84,9 @@
# Need better URI validation, but this will do for now. I think
# PEAR has a suitable module to help out here.
if ( !preg_match('/^[a-z0-9\+\.\-]+\:/i', $_POST['homepage']) )
- $errors[] = "Homepage must be a URI.";
+ $errors[] = 'Homepage must be a URI.';
if ( preg_match('/\s/', $_POST['homepage']) )
- $errors[] = "Homepage must be a URI. Valid URIs cannot
contain whitespace.";
+ $errors[] = 'Homepage must be a URI. Valid URIs cannot
contain whitespace.';
}
if (!empty($_POST['avatar_uri']))
@@ -94,9 +94,9 @@
# Need better URI validation, but this will do for now. I think
# PEAR has a suitable module to help out here.
if ( !preg_match('/^[a-z0-9\+\.\-]+\:/i', $_POST['avatar_uri'])
)
- $errors[] = "Avatar must be a URI.";
+ $errors[] = 'Avatar must be a URI.';
if ( preg_match('/\s/', $_POST['avatar_uri']) )
- $errors[] = "Avatar must be a URI. Valid URIs cannot
contain whitespace.";
+ $errors[] = 'Avatar must be a URI. Valid URIs cannot
contain whitespace.';
}
if (!isset($errors[0]))
@@ -125,13 +125,13 @@
$group->save();
- header("Location: " . $group->getURL());
+ header('Location: ' . $group->getURL());
exit;
}
if (isset($errors[0]))
{
- header("Content-Type: text/plain");
+ header('Content-Type: text/plain');
//($errors);
exit;
}
Modified: trunk/nixtape/explore.php
===================================================================
--- trunk/nixtape/explore.php 2009-05-10 15:07:40 UTC (rev 1473)
+++ trunk/nixtape/explore.php 2009-05-10 20:21:55 UTC (rev 1474)
@@ -34,9 +34,9 @@
$aTopArtists = Server::getTopArtists(20);
if (!PEAR::isError ($aTopArtists)) {
- $smarty->assign("topartists", $aTopArtists);
+ $smarty->assign('topartists', $aTopArtists);
}
-$smarty->assign("explore", true);
-$smarty->display("explore-artists.tpl");
+$smarty->assign('explore', true);
+$smarty->display('explore-artists.tpl');
?>
Modified: trunk/nixtape/group.php
===================================================================
--- trunk/nixtape/group.php 2009-05-10 15:07:40 UTC (rev 1473)
+++ trunk/nixtape/group.php 2009-05-10 20:21:55 UTC (rev 1474)
@@ -54,14 +54,14 @@
elseif ($_GET['action'] == 'leave')
$group->memberLeave($this_user);
- header("Location: " . $group->getURL());
+ header('Location: ' . $group->getURL());
exit;
}
if(isset($group->name)) {
- $smarty->assign("id", $group->id);
+ $smarty->assign('id', $group->id);
$smarty->assign('group', $group->name);
$smarty->assign('fullname', $group->fullname);
$smarty->assign('bio', $group->bio);
Modified: trunk/nixtape/index.php
===================================================================
--- trunk/nixtape/index.php 2009-05-10 15:07:40 UTC (rev 1473)
+++ trunk/nixtape/index.php 2009-05-10 20:21:55 UTC (rev 1474)
@@ -26,12 +26,12 @@
$smarty->assign('welcome', true);
-$station = "librefm://globaltags/rock";
+$station = 'librefm://globaltags/rock';
if(isset($this_user)) {
$radio_session = $this_user->getRadioSession($station);
} else {
$radio_session = Server::getRadioSession($station);
}
-$smarty->assign("radio_session", $radio_session);
+$smarty->assign('radio_session', $radio_session);
$smarty->display('welcome.tpl');
?>
Modified: trunk/nixtape/install.php
===================================================================
--- trunk/nixtape/install.php 2009-05-10 15:07:40 UTC (rev 1473)
+++ trunk/nixtape/install.php 2009-05-10 20:21:55 UTC (rev 1474)
@@ -23,19 +23,19 @@
require_once('version.php');
require_once('utils/get_absolute_url.php');
-if(file_exists("config.php")) {
- die("A configuration file already exists. Please delete
<i>config.php</i> if you wish to reinstall.");
+if(file_exists('config.php')) {
+ die('A configuration file already exists. Please delete
<i>config.php</i> if you wish to reinstall.');
}
if (isset($_POST['install'])) {
//Get the database connection string
$dbms = $_POST['dbms'];
- if($dbms == "sqlite") {
+ if($dbms == 'sqlite') {
$filename = $_POST['filename'];
- $connect_string = "sqlite:///" . $filename;
+ $connect_string = 'sqlite:///' . $filename;
} else {
- $connect_string = $dbms . "://" . $_POST['username'] . ":" .
$_POST['password'] . "@" . $_POST['hostname'] . ":" . $_POST['port'] . "/" .
$_POST['dbname'];
+ $connect_string = $dbms . '://' . $_POST['username'] . ':' .
$_POST['password'] . '@' . $_POST['hostname'] . ':' . $_POST['port'] . '/' .
$_POST['dbname'];
}
// Check the connection
@@ -45,7 +45,7 @@
}
$mdb2->disconnect();
- $install_path = dirname(__FILE__) . "/";
+ $install_path = dirname(__FILE__) . '/';
$default_theme = $_POST['default_theme'];
$base_url = $_POST['base_url'];
@@ -54,16 +54,16 @@
//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 . "'; ";
- $conf_file = fopen("config.php", "w");
+ $conf_file = fopen('config.php', 'w');
$result = fwrite($conf_file, $config);
fclose($conf_file);
if(!$result) {
- $print_config = str_replace("<", "<", $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>");
+ $print_config = str_replace('<', '<', $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!");
+ die('Configuration completed successfully!');
}
?>
@@ -72,13 +72,13 @@
<title>Libre.fm Website Installer</title>
<script type='text/javascript'>
function showSqlite() {
-
document.getElementById("sqlite").style.visibility = "visible";
-
document.getElementById("networkdbms").style.visibility = "hidden";
+
document.getElementById('sqlite').style.visibility = 'visible';
+
document.getElementById('networkdbms').style.visibility = 'hidden';
}
function showNetworkDBMS() {
-
document.getElementById("sqlite").style.visibility = "hidden";
-
document.getElementById("networkdbms").style.visibility = "visible";
+
document.getElementById('sqlite').style.visibility = 'hidden';
+
document.getElementById('networkdbms').style.visibility = 'visible';
}
</script>
</head>
@@ -107,10 +107,10 @@
<h2>General</h2>
Default Theme: <select name="default_theme">
<?php
- $dir = opendir("themes");
+ $dir = opendir('themes');
while($theme = readdir($dir)) {
- if(is_dir("themes/" . $theme) &&
$theme[0] != ".") {
- echo "<option>" . $theme .
"</option>";
+ if(is_dir('themes/' . $theme) &&
$theme[0] != '.') {
+ echo '<option>' . $theme .
'</option>';
}
}
?>
Modified: trunk/nixtape/invite.php
===================================================================
--- trunk/nixtape/invite.php 2009-05-10 15:07:40 UTC (rev 1473)
+++ trunk/nixtape/invite.php 2009-05-10 20:21:55 UTC (rev 1474)
@@ -23,7 +23,7 @@
require_once('templating.php');
require_once('utils/EmailAddressValidator.php');
-echo "<p>Invites are disabled.</p>";
+echo '<p>Invites are disabled.</p>';
/*
if(!$logged_in) {
Modified: trunk/nixtape/licenses.php
===================================================================
--- trunk/nixtape/licenses.php 2009-05-10 15:07:40 UTC (rev 1473)
+++ trunk/nixtape/licenses.php 2009-05-10 20:21:55 UTC (rev 1474)
@@ -1,29 +1,29 @@
<?php
-define('BY1', 1);
-define('BY2', 2);
-define('BY21', 3);
-define('BY25', 4);
-define('BY3', 5);
-define('BYSA1', 6);
-define('BYSA2', 7);
-define('BYSA21', 8);
-define('BYSA25', 9);
-define('BYSA3', 10);
-define('LAL', 11);
+define('BY1', 1);
+define('BY2', 2);
+define('BY21', 3);
+define('BY25', 4);
+define('BY3', 5);
+define('BYSA1', 6);
+define('BYSA2', 7);
+define('BYSA21', 8);
+define('BYSA25', 9);
+define('BYSA3', 10);
+define('LAL', 11);
// Arrays containing regular expressions for each license type
// (so we can support multiple URL formats in the future if needed)
-$by1 = array("http://creativecommons.org/licenses/by/1.0/?.*");
-$by2 = array("http://creativecommons.org/licenses/by/2.0/?.*");
-$by21 = array("http://creativecommons.org/licenses/by/2.1/?.*");
-$by25 = array("http://creativecommons.org/licenses/by/2.5/?.*");
-$by3 = array("http://creativecommons.org/licenses/by/3.0/?.*");
-$bysa1 = array("http://creativecommons.org/licenses/by-sa/1.0/?.*");
-$bysa2 = array("http://creativecommons.org/licenses/by-sa/2.0/?.*");
-$bysa21 = array("http://creativecommons.org/licenses/by-sa/2.1/?.*");
-$bysa25 = array("http://creativecommons.org/licenses/by-sa/2.5/?.*");
-$bysa3 = array("http://creativecommons.org/licenses/by-sa/3.0/?.*");
-$lal = array("http://artlibre.org/licence.php/lal.html");
+$by1 = array('http://creativecommons.org/licenses/by/1.0/?.*');
+$by2 = array('http://creativecommons.org/licenses/by/2.0/?.*');
+$by21 = array('http://creativecommons.org/licenses/by/2.1/?.*');
+$by25 = array('http://creativecommons.org/licenses/by/2.5/?.*');
+$by3 = array('http://creativecommons.org/licenses/by/3.0/?.*');
+$bysa1 = array('http://creativecommons.org/licenses/by-sa/1.0/?.*');
+$bysa2 = array('http://creativecommons.org/licenses/by-sa/2.0/?.*');
+$bysa21 = array('http://creativecommons.org/licenses/by-sa/2.1/?.*');
+$bysa25 = array('http://creativecommons.org/licenses/by-sa/2.5/?.*');
+$bysa3 = array('http://creativecommons.org/licenses/by-sa/3.0/?.*');
+$lal = array('http://artlibre.org/licence.php/lal.html');
// map licenses to ids by array position
$licenses = array(array(), $by1, $by2, $by21, $by25, $by3, $bysa1, $bysa2,
$bysa21, $bysa25, $bysa3, $lal);
Modified: trunk/nixtape/listen.php
===================================================================
--- trunk/nixtape/listen.php 2009-05-10 15:07:40 UTC (rev 1473)
+++ trunk/nixtape/listen.php 2009-05-10 20:21:55 UTC (rev 1474)
@@ -29,14 +29,14 @@
}
if(isset($_GET['tag'])) {
- $station = "librefm://globaltags/" . $_GET['tag'];
+ $station = 'librefm://globaltags/' . $_GET['tag'];
if(isset($this_user)) {
$radio_session = $this_user->getRadioSession($station);
} else {
$radio_session = Server::getRadioSession($station);
}
- $smarty->assign("radio_session", $radio_session);
+ $smarty->assign('radio_session', $radio_session);
}
-$smarty->display("listen.tpl");
+$smarty->display('listen.tpl');
?>
Modified: trunk/nixtape/location.php
===================================================================
--- trunk/nixtape/location.php 2009-05-10 15:07:40 UTC (rev 1473)
+++ trunk/nixtape/location.php 2009-05-10 20:21:55 UTC (rev 1474)
@@ -34,7 +34,7 @@
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",
+ $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);
@@ -46,7 +46,7 @@
}
$smarty->assign('country', strtoupper($_REQUEST['country']));
- $res = $mdb2->query(sprintf("SELECT * FROM Countries WHERE country=%s
LIMIT 1",
+ $res = $mdb2->query(sprintf('SELECT * FROM Countries WHERE country=%s
LIMIT 1',
$mdb2->quote(strtoupper($_REQUEST['country']), 'text')));
if ( $row = $res->fetchRow(MDB2_FETCHMODE_ASSOC) )
{
Modified: trunk/nixtape/login.php
===================================================================
--- trunk/nixtape/login.php 2009-05-10 15:07:40 UTC (rev 1473)
+++ trunk/nixtape/login.php 2009-05-10 20:21:55 UTC (rev 1474)
@@ -72,16 +72,18 @@
if(isset($logged_in) && $logged_in) {
// Check that return URI is on this server. Prevents possible phishing
uses.
- if ( substr($_POST['return'], 0, 1) == '/' )
- { header(sprintf('Location: http://%s%s',
$_SERVER['SERVER_NAME'], $_POST['return'])); }
- else
- { header("Location: $base_url"); }
+ if ( substr($_POST['return'], 0, 1) == '/' ) {
+ header(sprintf('Location: http://%s%s',
$_SERVER['SERVER_NAME'], $_POST['return']));
+ } else {
+ header('Location: ' . $base_url);
+ }
} else {
- if ( substr($_REQUEST['return'], 0, 1) == '/' )
- { $smarty->assign('return', $_REQUEST['return']); }
- else
- { $smarty->assign('return', ''); }
+ if ( substr($_REQUEST['return'], 0, 1) == '/' ) {
+ $smarty->assign('return', $_REQUEST['return']);
+ } else {
+ $smarty->assign('return', '');
+ }
$smarty->assign('username', $username);
$smarty->assign('errors', $errors);
Modified: trunk/nixtape/rdf.php
===================================================================
--- trunk/nixtape/rdf.php 2009-05-10 15:07:40 UTC (rev 1473)
+++ trunk/nixtape/rdf.php 2009-05-10 20:21:55 UTC (rev 1474)
@@ -26,7 +26,7 @@
$fmt = $_GET['fmt'];
if (empty($fmt)) $fmt = 'xml';
-if (empty($page)) die("Required parameter 'page' not provided.");
+if (empty($page)) die('Required parameter \'page\' not provided.');
$parser = ARC2::getSemHTMLParser(array('sem_html_formats' => 'rdfa'));
$parser->parse($base_url . $page);
@@ -49,33 +49,35 @@
switch ($fmt)
{
case 'xml' :
- header("Content-Type: application/rdf+xml");
+ header('Content-Type: application/rdf+xml');
$ser = ARC2::getRDFXMLSerializer($conf);
break;
case 'ttl' :
- header("Content-Type: application/x-turtle");
+ header('Content-Type: application/x-turtle');
$ser = ARC2::getTurtleSerializer($conf);
break;
case 'rss' :
- header("Content-Type: application/rss+xml");
+ header('Content-Type: application/rss+xml');
$ser = ARC2::getRSS10Serializer($conf);
break;
case 'json' :
if ($_GET['callback'])
- { header("Content-Type: text/javascript"); }
+ { header('Content-Type: text/javascript'); }
else
- { header("Content-Type: application/json"); }
+ { header('Content-Type: application/json'); }
$ser = ARC2::getRDFJSONSerializer($conf);
break;
case 'nt' :
- header("Content-Type: text/plain");
+ header('Content-Type: text/plain');
$ser = ARC2::getNTriplesSerializer($conf);
break;
}
-if ($_GET['callback'])
+if ($_GET['callback']) {
print $_GET['callback'] . '(';
+}
print $ser->getSerializedIndex($index);
-if ($_GET['callback'])
+if ($_GET['callback']) {
print ');';
+}
Modified: trunk/nixtape/recovery.php
===================================================================
--- trunk/nixtape/recovery.php 2009-05-10 15:07:40 UTC (rev 1473)
+++ trunk/nixtape/recovery.php 2009-05-10 20:21:55 UTC (rev 1474)
@@ -35,7 +35,7 @@
}
if (isset($_GET['code'])) {
- $res = $mdb2->query("SELECT * FROM Recovery_Request WHERE code=" .
$mdb2->quote($_GET['code'], 'text'));
+ $res = $mdb2->query('SELECT * FROM Recovery_Request WHERE code=' .
$mdb2->quote($_GET['code'], 'text'));
if ($res->numRows() == 0) {
$errors .= "Invalid recovery token.\n";
$smarty->assign('errors', $errors);
@@ -45,8 +45,8 @@
$row = $res->fetchRow(MDB2_FETCHMODE_ASSOC);
- $password = "";
- $chars = "abcdefghijklmnopqrstuvwxyz0123456789";
+ $password = '';
+ $chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
for ($i = 0; $i < 8; $i++) {
$password .= substr($chars, mt_rand(0, strlen($chars)-1), 1);
@@ -54,14 +54,14 @@
$email = $row['email'];
- $sql = "UPDATE Users SET password=" . $mdb2->quote(md5($password), 'text')
. " WHERE email="
+ $sql = 'UPDATE Users SET password=' . $mdb2->quote(md5($password), 'text')
. ' WHERE email='
. $mdb2->quote($email, 'text');
$mdb2->exec($sql);
$content = "Hi!\n\nYour password has been set to " . $password . "\n\n -
The Libre.fm Team";
sendEmail($content, $email);
- $sql = "DELETE FROM Recovery_Request WHERE code=" . $mdb2->quote($email,
'text');
+ $sql = 'DELETE FROM Recovery_Request WHERE code=' . $mdb2->quote($email,
'text');
$mdb2->exec($sql);
$smarty->assign('changed', true);
}
@@ -69,7 +69,7 @@
else if (isset($_POST['user'])) {
$username = $_POST['user'];
- $res = $mdb2->query("SELECT * FROM Users WHERE username="
+ $res = $mdb2->query('SELECT * FROM Users WHERE username="'
. $mdb2->quote($username, 'text'));
if (PEAR::isError($res) || $res->numRows() == 0) {
@@ -80,27 +80,27 @@
}
$row = $res->fetchRow(MDB2_FETCHMODE_ASSOC);
$code = md5($username . $row['email'] . time());
- $sql = "INSERT INTO Recovery_Request (username, email, code, expires)
VALUES("
- . $mdb2->quote($username, 'text') . ", "
- . $mdb2->quote($row['email'], 'text') . ", "
- . $mdb2->quote($code, 'text') . ", "
- . $mdb2->quote(time() + 86400, 'text') . ")";
+ $sql = 'INSERT INTO Recovery_Request (username, email, code, expires)
VALUES('
+ . $mdb2->quote($username, 'text') . ', '
+ . $mdb2->quote($row['email'], 'text') . ', '
+ . $mdb2->quote($code, 'text') . ', '
+ . $mdb2->quote(time() + 86400, 'text') . ')';
$res = $mdb2->exec($sql);
if (PEAR::isError($res)) {
- $errors .= "Error on: " . $sql;
+ $errors .= 'Error on: ' . $sql;
$smarty->assign('errors', $errors);
$smarty->display('error.tpl');
die();
}
- $url = $base_url . "/recovery.php?code=" . $code;
+ $url = $base_url . '/recovery.php?code=' . $code;
$content = "Hi!\n\nSomeone from the IP-address " . $_SERVER['REMOTE_ADDR']
. " entered your username "
- . "in the Password Recovery Form @ libre.fm. To change you password,
please visit\n\n"
+ . "in the password recovery 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->display("recovery.tpl");
+$smarty->display('recovery.tpl');
?>
Modified: trunk/nixtape/register.php
===================================================================
--- trunk/nixtape/register.php 2009-05-10 15:07:40 UTC (rev 1473)
+++ trunk/nixtape/register.php 2009-05-10 20:21:55 UTC (rev 1474)
@@ -19,12 +19,12 @@
*/
-require_once("database.php");
-require_once("templating.php");
-require_once("utils/EmailAddressValidator.php");
+require_once('database.php');
+require_once('templating.php');
+require_once('utils/EmailAddressValidator.php');
if($logged_in == true){
- header("Location: index.php");
+ header('Location: index.php');
} else {
// Moving to open alpha
@@ -43,9 +43,9 @@
}
if(isset($_GET['auth'])) {
$authcode = $_GET['auth'];
- $res = $mdb2->query("SELECT * FROM AccountActivation WHERE authcode = "
. $mdb2->quote($authcode, 'text'));
+ $res = $mdb2->query('SELECT * FROM AccountActivation WHERE authcode = '
. $mdb2->quote($authcode, 'text'));
if (PEAR::isError($res) || !$res->numRows()) {
- $errors = "Unknown activationcode.";
+ $errors = 'Unknown activationcode.';
$smarty->assign('errors', $errors);
$smarty->display('error.tpl');
die();
@@ -53,10 +53,10 @@
$row = $res->fetchRow(MDB2_FETCHMODE_ASSOC);
- $sql = "UPDATE Users SET active = 1 WHERE username = " .
$mdb2->quote($row['username'], 'text');
+ $sql = 'UPDATE Users SET active = 1 WHERE username = ' .
$mdb2->quote($row['username'], 'text');
$res = $mdb2->exec($sql);
if (PEAR::isError($res)) {
- $errors = "Error: " . $res->getUserInfo();
+ $errors = 'Error: ' . $res->getUserInfo();
$smarty->assign('errors', $errors);
$smarty->display('error.tpl');
die();
@@ -66,7 +66,7 @@
if(isset($_POST['register'])) {
- $errors = "";
+ $errors = '';
$username = $_POST['username'];
$password = $_POST['password'];
$passwordrepeat = $_POST['password-repeat'];
@@ -77,66 +77,66 @@
//Basic validation
- if(!preg_match("/^[a-zA-Z0-9_]{3,16}$/", $username)) {
- $errors .= "Your username must be atleast 3 characters in
length (max 16) and only consist of <i>a-z, A-Z, 0-9</i> and _ (underscore).<br
/>";
+ if(!preg_match('/^[a-zA-Z0-9_]{3,16}$/', $username)) {
+ $errors .= 'Your username must be atleast 3 characters in
length (max 16) and only consist of <i>a-z, A-Z, 0-9</i> and _ (underscore).<br
/>';
}
if(empty($password)) {
- $errors .= "You must enter a password.<br />";
+ $errors .= 'You must enter a password.<br />';
}
if($password != $passwordrepeat) {
- $errors .= "Your passwords do not match.<br />";
+ $errors .= 'Your passwords do not match.<br />';
}
if(empty($email)) {
- $errors .= "You must enter an e-mail address.<br />";
+ $errors .= 'You must enter an e-mail address.<br />';
} else {
$validator = new EmailAddressValidator();
if (!$validator->check_email_address($email)) {
- $errors .= "You must provide a valid email address!<br />";
+ $errors .= 'You must provide a valid email address!<br />';
}
}
//Check this username is available
- $res = $mdb2->query("SELECT username FROM Users WHERE lower(username) =
" . $mdb2->quote(strtolower($username)));
+ $res = $mdb2->query('SELECT username FROM Users WHERE lower(username) =
' . $mdb2->quote(strtolower($username)));
if($res->numRows()) {
- $errors .= "Sorry, that username is already registered.<br />";
+ $errors .= 'Sorry, that username is already registered.<br />';
}
if(empty($errors)) {
// Create the user
- $sql = "INSERT INTO Users (username, password, email, fullname,
bio, location, created, active) VALUES ("
- . $mdb2->quote($username, "text") . ", "
- . $mdb2->quote(md5($password), "text") . ", "
- . $mdb2->quote($email, "text") . ", "
- . $mdb2->quote($fullname, "text") . ", "
- . $mdb2->quote($bio, "text") . ", "
- . $mdb2->quote($location, "text") . ", "
- . time() . ", 0)";
+ $sql = 'INSERT INTO Users (username, password, email, fullname,
bio, location, created, active) VALUES ('
+ . $mdb2->quote($username, 'text') . ', '
+ . $mdb2->quote(md5($password), 'text') . ', '
+ . $mdb2->quote($email, 'text') . ', '
+ . $mdb2->quote($fullname, 'text') . ', '
+ . $mdb2->quote($bio, 'text') . ', '
+ . $mdb2->quote($location, 'text') . ', '
+ . time() . ', 0)';
$insert = $mdb2->exec($sql);
if (PEAR::isError($insert)) {
- reportError("Create user, insert, register.php",
$res->getUserInfo());
- $errors .= "An error occurred.";
+ reportError('Create user, insert, register.php',
$res->getUserInfo());
+ $errors .= 'An error occurred.';
$smarty->assign('errors', $errors);
$smarty->display('error.tpl');
die();
}
$code = md5($username . time());
- $sql = "INSERT INTO AccountActivation (username, authcode)
VALUES("
- . $mdb2->quote($username, 'text') . ", "
- . $mdb2->quote($code, 'text') . ")";
+ $sql = 'INSERT INTO AccountActivation (username, authcode)
VALUES('
+ . $mdb2->quote($username, 'text') . ', '
+ . $mdb2->quote($code, 'text') . ')';
$res = $mdb2->exec($sql);
if (PEAR::isError($res)) {
- reportError("AccountActivation, insert, register.php",
$res->getUserInfo());
- $errors .= "An error occurred.";
+ reportError('AccountActivation, insert, register.php',
$res->getUserInfo());
+ $errors .= 'An error occurred.';
$smarty->assign('errors', $errors);
$smarty->display('error.tpl');
die();
}
- $url = $base_url . "/register.php?auth=" . $code;
+ $url = $base_url . '/register.php?auth=' . $code;
$content = "Hi!\n\nSomeone from the IP-address " .
$_SERVER['REMOTE_ADDR'] . " registered an account "
- . "@ http://alpha.libre.fm. If this was you, please visit
the webpage specified below to activate "
+ . "at http://alpha.libre.fm. If this was you, please visit
the webpage specified below to activate "
. "your account. If not, please disregard this email.\n\n"
. $url . "\n\n- The Libre.fm Team";
sendEmail($content, $email);
@@ -144,19 +144,19 @@
//$mdb2->query("UPDATE Invitations SET code = NULL, invitee = "
. $mdb2->quote($username, "text") . " WHERE code = " . $mdb2->quote($authcode,
"text"));
//$removesql = "DELETE FROM Invitation_Request WHERE email=" .
$mdb2->quote($email, 'text');
//$mdb2->exec($removesql);
- $smarty->assign("registered", true);
+ $smarty->assign('registered', true);
} else {
- $smarty->assign("username", $username);
- $smarty->assign("fullname", $fullname);
- $smarty->assign("email", $email);
- $smarty->assign("location", $location);
- $smarty->assign("bio", $bio);
- $smarty->assign("errors", $errors);
+ $smarty->assign('username', $username);
+ $smarty->assign('fullname', $fullname);
+ $smarty->assign('email', $email);
+ $smarty->assign('location', $location);
+ $smarty->assign('bio', $bio);
+ $smarty->assign('errors', $errors);
}
}
//$smarty->assign("invalid_authcode", $invalid_authcode);
//$smarty->assign("authcode", $authcode);
-$smarty->display("register.tpl");
+$smarty->display('register.tpl');
}
?>
Modified: trunk/nixtape/resolve-external.php
===================================================================
--- trunk/nixtape/resolve-external.php 2009-05-10 15:07:40 UTC (rev 1473)
+++ trunk/nixtape/resolve-external.php 2009-05-10 20:21:55 UTC (rev 1474)
@@ -1,6 +1,6 @@
<?php
function resolve_external_url($url) {
- if (substr($url, 0, 10) == "jamendo://") {
+ if (substr($url, 0, 10) == 'jamendo://') {
return process_jamendo_url($url);
}
@@ -8,19 +8,19 @@
}
function process_jamendo_url($url) {
- if (substr($url, 10, 13) == "track/stream/") {
+ if (substr($url, 10, 13) == 'track/stream/') {
$id = substr($url, 23);
- return "http://api.jamendo.com/get2/stream/track/redirect/?id="
. $id . "&streamencoding=ogg2";
+ return 'http://api.jamendo.com/get2/stream/track/redirect/?id='
. $id . '&streamencoding=ogg2';
}
- if (substr($url, 10, 15) == "album/download/") {
+ if (substr($url, 10, 15) == 'album/download/') {
$id = substr($url, 25);
- return
"http://api.jamendo.com/get2/bittorrent/file/plain/?album_id=" . $id .
"&type=archive&class=ogg3";
+ return
'http://api.jamendo.com/get2/bittorrent/file/plain/?album_id=' . $id .
'&type=archive&class=ogg3';
}
- if (substr($url, 10, 10) == "album/art/") {
+ if (substr($url, 10, 10) == 'album/art/') {
$id = substr($url, 20);
- return "http://api.jamendo.com/get2/image/album/redirect/?id="
. $id . "&imagesize=200";
+ return 'http://api.jamendo.com/get2/image/album/redirect/?id='
. $id . '&imagesize=200';
}
// We don't know what this is
Modified: trunk/nixtape/scrobble-proxy.php
===================================================================
--- trunk/nixtape/scrobble-proxy.php 2009-05-10 15:07:40 UTC (rev 1473)
+++ trunk/nixtape/scrobble-proxy.php 2009-05-10 20:21:55 UTC (rev 1474)
@@ -21,10 +21,10 @@
require_once('config.php');
-if ($_GET['method'] == "scrobble") {
- $url = $submissions_server . "/submissions/1.2/";
-} elseif ($_GET['method'] == "nowplaying") {
- $url = $submissions_server . "/nowplaying/1.2/";
+if ($_GET['method'] == 'scrobble') {
+ $url = $submissions_server . '/submissions/1.2/';
+} elseif ($_GET['method'] == 'nowplaying') {
+ $url = $submissions_server . '/nowplaying/1.2/';
} else {
die("Invalid proxy method\n");
}
@@ -36,7 +36,7 @@
if (is_array($element)) {
$i = 0;
foreach($element as $e) {
- $post_vars .= $key . "[" . $i . "]=" . $e . "&";
+ $post_vars .= $key . '[' . $i . ']=' . $e . '&';
$i++;
}
} else {
Modified: trunk/nixtape/templating.php
===================================================================
--- trunk/nixtape/templating.php 2009-05-10 15:07:40 UTC (rev 1473)
+++ trunk/nixtape/templating.php 2009-05-10 20:21:55 UTC (rev 1474)
@@ -24,13 +24,13 @@
require_once('smarty/Smarty.class.php');
if($_GET['lang']) {
- $languages = array($_GET['lang'] . ".UTF-8");
- setcookie('lang', $_GET['lang'] . ".UTF-8", time() + 31536000);
+ $languages = array($_GET['lang'] . '.UTF-8');
+ setcookie('lang', $_GET['lang'] . '.UTF-8', time() + 31536000);
} elseif (isset($_COOKIE['lang'])) {
$languages = array($_COOKIE['lang']);
} else {
// Attempt to mangle browser language strings in to valid gettext
locales (needs a big lookup table to be 100% accurate)
- $languages = preg_split("/,/", $_SERVER['HTTP_ACCEPT_LANGUAGE']);
+ $languages = preg_split('/,/', $_SERVER['HTTP_ACCEPT_LANGUAGE']);
for($i = 0; $i < count($languages); $i++) {
$languages[$i] = preg_replace('/;q=\d\.\d/', '',
$languages[$i]);
if(strlen($languages[$i]) == 2) {
@@ -40,12 +40,12 @@
$languages[$i] = $lcomponents[0] . '_' .
strtoupper($lcomponents[1]);
}
- $languages[$i] = $languages[$i] . ".UTF-8";
+ $languages[$i] = $languages[$i] . '.UTF-8';
}
}
$current_lang = setlocale(LC_ALL, $languages);
-bindtextdomain("nixtape", $install_path . '/themes/' . $default_theme .
'/locale/');
-textdomain("nixtape");
+bindtextdomain('nixtape', $install_path . '/themes/' . $default_theme .
'/locale/');
+textdomain('nixtape');
$smarty = new Smarty();
@@ -76,7 +76,7 @@
$smarty-assign('random_group', $random_group);
} */
-header("Content-Type: text/html; charset=utf-8");
+header('Content-Type: text/html; charset=utf-8');
function insert_getMenu($lidsid, $smrt) {
$smrt->display('menu.tpl');
Modified: trunk/nixtape/track.php
===================================================================
--- trunk/nixtape/track.php 2009-05-10 15:07:40 UTC (rev 1473)
+++ trunk/nixtape/track.php 2009-05-10 20:21:55 UTC (rev 1474)
@@ -26,13 +26,13 @@
require_once('data/TagCloud.php');
$track = new Track(urldecode($_GET['track']), urldecode($_GET['artist']));
-$smarty->assign("track", $track);
+$smarty->assign('track', $track);
$album = new Album($track->album_name, $track->artist_name);
-$smarty->assign("album", $album);
+$smarty->assign('album', $album);
$artist = new Artist($track->artist_name);
-$smarty->assign("artist", $artist);
+$smarty->assign('artist', $artist);
// no idea how this would be track-relevant
$aTagCloud = TagCloud::GenerateTagCloud(TagCloud::scrobblesTable(), 'artist');
@@ -40,19 +40,19 @@
$smarty->assign('tagcloud', $aTagCloud);
}
-$res = $mdb2->query("SELECT * FROM Track WHERE lower(artist_name) = " .
$mdb2->quote(mb_strtolower($track->artist_name, "UTF-8"),"text") . " AND
lower(name) = " . $mdb2->quote(mb_strtolower($track->name, "UTF-8"),"text"));
+$res = $mdb2->query('SELECT * FROM Track WHERE lower(artist_name) = ' .
$mdb2->quote(mb_strtolower($track->artist_name, 'UTF-8'), 'text') . ' AND
lower(name) = ' . $mdb2->quote(mb_strtolower($track->name, 'UTF-8'), 'text'));
$aOtheralbums = array();
$i = 0;
while (($row = $res->fetchRow(MDB2_FETCHMODE_ASSOC))) {
$trow = sanitize($row);
- if ($trow["album"]) {
- $aOtherAlbums[$i++] = new Album($trow["album"],
$trow["artist"]);
+ if ($trow['album']) {
+ $aOtherAlbums[$i++] = new Album($trow['album'],
$trow['artist']);
}
}
-$smarty->assign("albums", $aOtherAlbums);
+$smarty->assign('albums', $aOtherAlbums);
$smarty->assign('extra_head_links', array(
array(
@@ -63,5 +63,5 @@
)
));
-$smarty->display("track.tpl");
+$smarty->display('track.tpl');
?>
Modified: trunk/nixtape/user-edit.php
===================================================================
--- trunk/nixtape/user-edit.php 2009-05-10 15:07:40 UTC (rev 1473)
+++ trunk/nixtape/user-edit.php 2009-05-10 20:21:55 UTC (rev 1474)
@@ -41,9 +41,9 @@
# Need better URI validation, but this will do for now. I think
# PEAR has a suitable module to help out here.
if ( !preg_match('/^[a-z0-9\+\.\-]+\:/i', $_POST['id']) )
- $errors[] = "WebID must be a URI.";
+ $errors[] = 'WebID must be a URI.';
if ( preg_match('/\s/', $_POST['id']) )
- $errors[] = "WebID must be a URI. Valid URIs cannot
contain whitespace.";
+ $errors[] = 'WebID must be a URI. Valid URIs cannot
contain whitespace.';
}
if (!empty($_POST['homepage']))
@@ -51,9 +51,9 @@
# Need better URI validation, but this will do for now. I think
# PEAR has a suitable module to help out here.
if ( !preg_match('/^[a-z0-9\+\.\-]+\:/i', $_POST['homepage']) )
- $errors[] = "Homepage must be a URI.";
+ $errors[] = 'Homepage must be a URI.';
if ( preg_match('/\s/', $_POST['homepage']) )
- $errors[] = "Homepage must be a URI. Valid URIs cannot
contain whitespace.";
+ $errors[] = 'Homepage must be a URI. Valid URIs cannot
contain whitespace.';
}
if (!empty($_POST['avatar_uri']))
@@ -61,9 +61,9 @@
# Need better URI validation, but this will do for now. I think
# PEAR has a suitable module to help out here.
if ( !preg_match('/^[a-z0-9\+\.\-]+\:/i', $_POST['avatar_uri'])
)
- $errors[] = "Avatar must be a URI.";
+ $errors[] = 'Avatar must be a URI.';
if ( preg_match('/\s/', $_POST['avatar_uri']) )
- $errors[] = "Avatar must be a URI. Valid URIs cannot
contain whitespace.";
+ $errors[] = 'Avatar must be a URI. Valid URIs cannot
contain whitespace.';
}
if (!empty($_POST['laconica_profile']))
@@ -71,9 +71,9 @@
# Need better URI validation, but this will do for now. I think
# PEAR has a suitable module to help out here.
if ( !preg_match('/^[a-z0-9\+\.\-]+\:/i',
$_POST['laconica_profile']) )
- $errors[] = "Laconica profile must be a URI.";
+ $errors[] = 'Laconica profile must be a URI.';
if ( preg_match('/\s/', $_POST['laconica_profile']) )
- $errors[] = "Laconica profile must be a URI. Valid URIs
cannot contain whitespace.";
+ $errors[] = 'Laconica profile must be a URI. Valid URIs
cannot contain whitespace.';
}
if (!empty($_POST['journal_rss']))
@@ -81,15 +81,15 @@
# Need better URI validation, but this will do for now. I think
# PEAR has a suitable module to help out here.
if ( !preg_match('/^[a-z0-9\+\.\-]+\:/i',
$_POST['journal_rss']) )
- $errors[] = "Journal RSS must be a URI.";
+ $errors[] = 'Journal RSS must be a URI.';
if ( preg_match('/\s/', $_POST['journal_rss']) )
- $errors[] = "Journal RSS must be a URI. Valid URIs
cannot contain whitespace.";
+ $errors[] = 'Journal RSS must be a URI. Valid URIs
cannot contain whitespace.';
}
if (!empty($_POST['password_1']))
{
if ($_POST['password_1'] != $_POST['password_2'])
- $errors[] = "Passwords do not match.";
+ $errors[] = 'Passwords do not match.';
}
if (!empty($_POST['location_uri']))
@@ -97,7 +97,7 @@
# Currently only allow geonames URIs, but there's no reason we
can't accept
# others at some point in the future. (e.g. dbpedia)
if ( !preg_match('/^http:\/\/sws.geonames.org\/[0-9]+\/$/',
$_POST['location_uri']) )
- $errors[] = "This should be a geonames.org semantic web
service URI.";
+ $errors[] = 'This should be a geonames.org semantic web
service URI.';
}
if (!isset($errors[0]))
@@ -119,13 +119,13 @@
$this_user->save();
- header("Location: " . $this_user->getURL());
+ header('Location: ' . $this_user->getURL());
exit;
}
if (isset($errors[0]))
{
- header("Content-Type: text/plain");
+ header('Content-Type: text/plain');
//($errors);
exit;
}
@@ -134,7 +134,7 @@
if(isset($this_user->name))
{
# Stuff which cannot be changed.
- $smarty->assign("acctid", $this_user->acctid);
+ $smarty->assign('acctid', $this_user->acctid);
$smarty->assign('avatar', $this_user->getAvatar());
$smarty->assign('user', $this_user->name);
@@ -146,7 +146,7 @@
if ($_POST['submit'])
{
- $smarty->assign("id", $_POST['id']);
+ $smarty->assign('id', $_POST['id']);
$smarty->assign('fullname', $_POST['fullname']);
$smarty->assign('bio', $_POST['bio']);
$smarty->assign('homepage', $_POST['homepage']);
@@ -158,7 +158,7 @@
}
else
{
- $smarty->assign("id", ($this_user->webid_uri));
+ $smarty->assign('id', ($this_user->webid_uri));
$smarty->assign('fullname', ($this_user->fullname));
$smarty->assign('bio', ($this_user->bio));
$smarty->assign('homepage', ($this_user->homepage));
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Librefm-commits] [1474] Fix some more space indentation,
Michael Sheldon <=