Commit 7a6b5ee1 authored by elleo's avatar elleo

Fix some more space indentation

Change more quoting to match coding standards
parent 59bba6f5
......@@ -28,65 +28,65 @@ $username = $u_user->name;
$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') . ')';
$affected =& $mdb2->exec($sql);
// 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());
}
if (PEAR::isError($affected)) {
die($affected->getMessage());
}
$url = $base_url . '/register.php?authcode=' . $code;
$headers = 'From: Libre.fm Invitations <invitations@libre.fm>';
$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 <invitations@libre.fm>';
$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');
......
......@@ -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->assign('extra_head_links', array(
)
));
$smarty->display("album.tpl");
$smarty->display('album.tpl');
?>
......@@ -28,9 +28,9 @@ require_once('data/TagCloud.php');
$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 @@ if (!PEAR::isError ($aTagCloud)) {
$aArtistAlbums = $artist->getAlbums();
if (!PEAR::isError($aArtistAlbums)) {
$smarty->assign("albums", $aArtistAlbums);
$smarty->assign('albums', $aArtistAlbums);
}
$smarty->assign('extra_head_links', array(
......
......@@ -53,7 +53,7 @@ class TagCloud {
$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))];
......
......@@ -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 @@ if (PEAR::isError($mdb2)) {
}
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() . ')');
}
?>
......@@ -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');
......
<?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 @@ if ($logged_in == false) {
$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 <account@libre.fm>';
$subject = 'Libre.fm Account Delete Request - Action needed!';
mail($email, $subject, $content, $headers);
......
......@@ -41,7 +41,7 @@ if ($_REQUEST['group']=='new')
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 @@ if ($_POST['submit'])
# 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 @@ if ($_POST['submit'])
# 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 @@ if ($_POST['submit'])
$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;
}
......
......@@ -34,9 +34,9 @@ if (!PEAR::isError ($aTagCloud)) {
$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');
?>
......@@ -54,14 +54,14 @@ if ($_GET['action'] && isset($this_user))
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);
......
......@@ -26,12 +26,12 @@ require_once('data/Server.php');
$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');
?>
......@@ -23,19 +23,19 @@ require_once('MDB2.php');
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 @@ if (isset($_POST['install'])) {
}
$mdb2->disconnect();
$install_path = dirname(__FILE__) . "/";
$install_path = dirname(__FILE__) . '/';
$default_theme = $_POST['default_theme'];
$base_url = $_POST['base_url'];
......@@ -54,16 +54,16 @@ if (isset($_POST['install'])) {
//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("<", "&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>");
$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!");
die('Configuration completed successfully!');
}
?>
......@@ -72,13 +72,13 @@ if (isset($_POST['install'])) {
<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 @@ if (isset($_POST['install'])) {
<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>';
}
}
?>
......
......@@ -23,7 +23,7 @@ require_once('database.php');
require_once('templating.php');
require_once('utils/EmailAddressValidator.php');
echo "<p>Invites are disabled.</p>";
echo '<p>Invites are disabled.</p>';
/*
if(!$logged_in) {
......
<?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);
......
......@@ -29,14 +29,14 @@ if (!PEAR::isError ($aTagCloud)) {
}
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');
?>
......@@ -34,7 +34,7 @@ else
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 @@ if ($_REQUEST['country'])
}
$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) )
{
......
......@@ -72,16 +72,18 @@ if(isset($_POST['login'])) {
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);
......
......@@ -26,7 +26,7 @@ $page = $_GET['page'];
$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 @@ $conf = array(
switch ($fmt)
{