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

Commit 98787f7d authored by tobyink's avatar tobyink

Beginning to apply some naming conventions to the files involved

in user profiles/info, because this area is bound to expand soon.
parent f365b19f
Options +FollowSymLinks
RewriteEngine on
RewriteRule ^user/([^/]+)/?$ profile.php?user=$1 [B,NC]
RewriteRule ^user/([^/]+)/?$ user-profile.php?user=$1 [B,NC]
RewriteRule ^user/([^/]+)/journal?$ user-journal.php?user=$1 [B,NC]
RewriteRule ^user/([^/]+)/groups?$ user-groups.php?user=$1 [B,NC]
RewriteRule ^artist/([^/]+)/track/([^/]+)/?$ track.php?artist=$1&track=$2 [B,NC]
RewriteRule ^artist/([^/]+)/album/([^/]+)/track/([^/]+)/?$ track.php?artist=$1&album=$2&track=$3 [B,NC]
RewriteRule ^artist/([^/]+)/album/([^/]+)/?$ album.php?artist=$1&album=$2 [B,NC]
......
......@@ -266,50 +266,62 @@ class Server {
* @param string $username The username we want a URL for
* @return A string containing URL to the user's profile
*/
static function getUserURL($username) {
static function getUserURL ($username, $component)
{
global $friendly_urls, $base_url;
if($friendly_urls) {
return $base_url . "/user/" . urlencode(stripslashes($username));
} else {
return $base_url . "/profile.php?user=" . urlencode(stripslashes($username));
if ($component == 'edit')
{
return $base_url . "/user-edit.php";
}
elseif($friendly_urls)
{
if ($component == 'profile')
$component = '';
else
$component = "/{$component}";
return $base_url . "/user/" . urlencode($username) . $component;
}
else
{
return $base_url . "/user-{$component}.php?user=" . urlencode($username);
}
}
static function getGroupURL($groupname) {
global $friendly_urls, $base_url;
if($friendly_urls) {
return $base_url . "/group/" . urlencode(stripslashes($groupname));
return $base_url . "/group/" . urlencode($groupname);
} else {
return $base_url . "/group.php?group=" . urlencode(stripslashes($groupname));
return $base_url . "/group.php?group=" . urlencode($groupname);
}
}
static function getArtistURL($artist) {
global $friendly_urls, $base_url;
if($friendly_urls) {
return $base_url . "/artist/" . urlencode(stripslashes($artist));
return $base_url . "/artist/" . urlencode($artist);
} else {
return $base_url . "/artist.php?artist=" . urlencode(stripslashes($artist));
return $base_url . "/artist.php?artist=" . urlencode($artist);
}
}
static function getAlbumURL($artist, $album) {
global $friendly_urls, $base_url;
if($friendly_urls) {
return $base_url . "/artist/" . urlencode(stripslashes($artist)) . "/album/" . urlencode(stripslashes($album));
return $base_url . "/artist/" . urlencode($artist) . "/album/" . urlencode($album);
} else {
return $base_url . "/album.php?artist=" . urlencode(stripslashes($artist)) . "&album=" . urlencode(stripslashes($album));
return $base_url . "/album.php?artist=" . urlencode($artist) . "&album=" . urlencode($album);
}
}
static function getTrackURL($artist, $album, $track) {
global $friendly_urls, $base_url;
if ($friendly_urls && $album) {
return $base_url . "/artist/" . urlencode(stripslashes($artist)) . "/album/" . urlencode(stripslashes($album)) . "/track/" . urlencode(stripslashes($track));
return $base_url . "/artist/" . urlencode($artist) . "/album/" . urlencode($album) . "/track/" . urlencode($track);
} elseif ($friendly_urls) {
return $base_url . "/artist/" . urlencode(stripslashes($artist)) . "/track/" . urlencode(stripslashes($track));
return $base_url . "/artist/" . urlencode($artist) . "/track/" . urlencode($track);
} else {
return $base_url . "/track.php?artist=" . urlencode(stripslashes($artist)) . "&album=" . urlencode(stripslashes($album)) . "&track=" . urlencode(stripslashes($track));
return $base_url . "/track.php?artist=" . urlencode($artist) . "&album=" . urlencode($album) . "&track=" . urlencode($track);
}
}
......
......@@ -149,8 +149,8 @@ class User {
return "http://www.gravatar.com/avatar/" . md5($this->email) . "?s=" . $size . "&d=monsterid";
}
function getURL() {
return Server::getUserURL($this->name);
function getURL($component='profile') {
return Server::getUserURL($this->name, $component);
}
/**
......
......@@ -9,7 +9,7 @@
<span class="fn" property="foaf:name">{$me->fullname|escape:'html':'UTF-8'}</span>
<span rel="foaf:holdsAccount" rev="sioc:account_of">
<span about="{$me->acctid|escape:'html':'UTF-8'}" typeof="sioc:User">
(<a class="nickname" property="foaf:accountName" href="{$base_url}/user/{$me->name}" rel="foaf:accountProfilePage" rev="foaf:topic">{$me->name|escape:'html':'UTF-8'}</a>)
(<a class="nickname" property="foaf:accountName" href="{$me->getURL()}" rel="foaf:accountProfilePage" rev="foaf:topic">{$me->name|escape:'html':'UTF-8'}</a>)
<span rel="foaf:accountServiceHomepage" resource="{$base_url}"></span>
</span>
</span>
......@@ -27,6 +27,6 @@
<dd class="note" property="bio:olb">{$me->bio|escape:'html':'UTF-8'}</dd>
</dl>
<hr style="border: 1px solid transparent; clear: both;" rel="foaf:page" rev="foaf:primaryTopic" resource="{$base_url}/user/{$me->name}" />
<hr style="border: 1px solid transparent; clear: both;" rel="foaf:page" rev="foaf:primaryTopic" resource="{$me->getURL()}" />
</div>
......@@ -9,11 +9,7 @@
<!-- We should try to make this list work like the gobbles list. -->
<dl class='now-playing'>
{section name=i loop=$nowplaying}
{if $scrobbles[i].license > 0}
<dt class='track-name libre'>{$nowplaying[i].track|escape:'html':'UTF-8'}</dt>
{else}
<dt class='track-name'>{$nowplaying[i].track|escape:'html':'UTF-8'}</dt>
{/if}
<dt class='track-name {if $scrobbles[i].license > 0}libre{/if}'>{$nowplaying[i].track|escape:'html':'UTF-8'}</dt>
<dd>by <span class='artist-name'><a href='{$nowplaying[i].artisturl|escape:'html':'UTF-8'}'>{$nowplaying[i].artist|escape:'html':'UTF-8'}</a></span></dd>
<dd>with <span class='gobbler'>{$nowplaying[i].clientstr}</span></dd>
{/section}
......
......@@ -153,7 +153,7 @@ if(isset($user->name))
$smarty->assign('tagcloud', $aTagCloud);
}
$smarty->assign('errors', $errors);
$smarty->display('edit_profile.tpl');
$smarty->display('user-edit.tpl');
}
else
......
......@@ -92,7 +92,7 @@ if ($rssFeed)
'href' => $base_url.'/rdf.php?fmt=rss&page='.htmlentities($_SERVER['REQUEST_URI'])
)
));
$smarty->display('journal.tpl');
$smarty->display('user-journal.tpl');
} else {
$smarty->assign('error', 'No RSS Feed for this User');
......
......@@ -79,7 +79,7 @@ if(isset($user->name)) {
$smarty->assign('toptracks', $user->getTopTracks());
$smarty->display('profile.tpl');
$smarty->display('user-profile.tpl');
} else {
$smarty->assign('error', 'User not found');
$smarty->assign('details', 'Shall I call in a missing persons report?');
......
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