We are no longer offering accounts on this server. Consider https://gitlab.freedesktop.org/ as a place to host projects.

Commit f52d2219 authored by elleo's avatar elleo

Remove executable prop from various files

Add documentation and sanitization to getScrobbles in User
Make the username a link to the profile
Make the homepage entry on the profile a link
parent d7ec70d1
......@@ -36,7 +36,7 @@ class User {
public $name, $email, $fullname, $bio, $location, $homepage, $error,$userlevel;
/**
* Artist constructor
* User constructor
*
* @param string name The name of the artist to load
*/
......@@ -54,15 +54,25 @@ class User {
$this->location = $row["location"];
$this->userlevel = $row["userlevel"];
}
}
function getscrobbles($number) {
}
/**
* Get a user's scrobles ordered by time
*
* @param int number The number of scrobbles to return
* @return An array of scrobbles
*/
function getScrobbles($number) {
global $mdb2;
$res = $mdb2->query("SELECT * FROM Scrobbles WHERE username = " .$mdb2->quote($this->name, "text") . " ORDER BY time DESC LIMIT ".$mdb2->quote($number, "integer"));
$data = $res->fetchAll(MDB2_FETCHMODE_ASSOC);
foreach($data as &$i) {
foreach($data as &$i) {
$i = sanitize($i);
$i["timehuman"] = human_timestamp($i["time"]);
}
return $data;
}
}
}
......@@ -39,7 +39,7 @@ if(isset($user->name)) {
$smarty->assign("bio", $user->bio);
$smarty->assign("homepage", $user->homepage);
$smarty->assign("location", $user->location);
$smarty->assign("scrobbles", $user->getscrobbles(10));
$smarty->assign("scrobbles", $user->getScrobbles(10));
$smarty->assign("userlevel", $user->userlevel);
$smarty->display("profile.tpl");
} else {
......
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
File mode changed from 100755 to 100644
<div id="menu">
{if isset($logged_in)}
<p>Logged in as: {$username}</p>
<p>Logged in as: <a href="{$base_url}/profile.php?user={$username|urlencode}">{$username}</a></p>
{/if}
<ul id="navigation">
......
......@@ -3,7 +3,7 @@
<h2>{$user}'s profile</h2>
Username: {$user} <br />
Real Name: {$fullname} <br />
Homepage: {$homepage} <br />
Homepage: <a href="{$homepage}">{$homepage}</a> <br />
Location: {$location} <br />
Bio: {$bio} <br />
<hr>
......
File mode changed from 100755 to 100644
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment