Commit 754e5618 authored by tobyink's avatar tobyink

Profile improvements.

parent 08657d0d
......@@ -34,7 +34,7 @@ class User {
public $name, $email, $fullname, $bio, $location, $homepage, $error, $userlevel;
public $id, $acctid, $avatar_uri, $location_uri, $webid_uri, $laconica_profile, $journal_rss;
public $password;
public $password, $has_identica;
/**
* User constructor
......@@ -74,6 +74,8 @@ class User {
$this->journal_rss = $row["journal_rss"];
$this->acctid = $this->getURL() . '#acct';
$this->has_identica = preg_match('#^http://identi\.ca/#i', $this->laconica_profile);
if (! preg_match('/\:/', $this->id))
$this->id = $this->getURL() . '#me';
}
......
......@@ -24,6 +24,11 @@
<a href="{$homepage|escape:'html':'UTF-8'}" rel="me foaf:homepage" class="url">{$homepage|escape:'html':'UTF-8'}</a>
</dd>
{/if}
{if $laconica_profile}
<dd>
<a href="{$laconica_profile|escape:'html':'UTF-8'}" rel="foaf:homepage" class="url">{$laconica_profile|escape:'html':'UTF-8'} (microblog)</a>
</dd>
{/if}
<dd rel="foaf:based_near">
<span {if $location_uri} about="{$location_uri|escape:'html':'UTF-8'}"{/if}>
<span class="label" property="rdfs:comment">{$location|escape:'html':'UTF-8'}</span>
......@@ -43,6 +48,11 @@
<dd class="note" property="bio:olb">{$bio|escape:'html':'UTF-8'}</dd>
</dl>
<div style="text-align:right;clear:right;font-size:80%">
<!-- These shouldn't be hard-coded. Will fix soon. -->
<a rel="rdfs:seeAlso" href="{$base_url}/user/{$user}">profile</a>
{if $journal_rss} &middot; <a rel="rdfs:seeAlso" href="{$base_url}/user/{$user}/journal">journal</a>{/if}
</div>
<hr style="border: 1px solid transparent; clear: both;" rel="foaf:page" rev="foaf:primaryTopic" resource="" />
</div>
......@@ -14,9 +14,10 @@
</span>
</span>
</dt>
{if $me->homepage}
{if $me->homepage || $me->laconica_profile}
<dd>
<a href="{$me->homepage|escape:'html':'UTF-8'}" rel="foaf:homepage" class="url">{$me->homepage|escape:'html':'UTF-8'}</a>
{if $me->homepage}<a href="{$me->homepage|escape:'html':'UTF-8'}" rel="foaf:homepage" class="url">{$me->homepage|escape:'html':'UTF-8'}</a>{/if}
{if $me->laconica_profile}{if $me->homepage} // {/if}<a href="{$me->laconica_profile|escape:'html':'UTF-8'}" rel="foaf:homepage" class="url">{$me->laconica_profile|escape:'html':'UTF-8'}</a>{/if}
</dd>
{/if}
<dd rel="foaf:based_near">
......
......@@ -36,66 +36,64 @@ if(!isset($_GET['user']) && $logged_in == false) {
$user = new User($_GET['user']);
# We need to get this from account profile really. This is just hard-coded for experimenting.
if ($user->name == 'tobyink')
$rssFeed = 'http://identi.ca/tobyink/rss';
if(! $user->journal_rss ) {
$smarty->assign('error', 'Error!');
$smarty->assign('details', 'You need an RSS feed set up for your account.');
$smarty->display('error.tpl');
die();
}
if ($rssFeed)
{
# We have to implement HTTP caching here!
$parser = ARC2::getRDFParser();
$parser->parse($rssFeed);
# We have to implement HTTP caching here!
$parser = ARC2::getRDFParser();
$parser->parse($user->journal_rss);
$index = $parser->getSimpleIndex();
krsort($index); // Newest last.
$items = array();
foreach ($index as $subject => $data)
$index = $parser->getSimpleIndex();
krsort($index); // Newest last.
$items = array();
foreach ($index as $subject => $data)
{
if (in_array('http://purl.org/rss/1.0/item', $data['http://www.w3.org/1999/02/22-rdf-syntax-ns#type']))
{
if (in_array('http://purl.org/rss/1.0/item', $data['http://www.w3.org/1999/02/22-rdf-syntax-ns#type']))
{
$ts = strtotime($data[ 'http://purl.org/dc/elements/1.1/date' ][0]);
$items[] = array(
'subject_uri' => $subject,
'title' => $data[ 'http://purl.org/rss/1.0/title' ][0],
'link' => $data[ 'http://purl.org/rss/1.0/link' ][0],
'date_iso' => $data[ 'http://purl.org/dc/elements/1.1/date' ][0],
'date_unix' => $ts,
'date_human' => human_timestamp($ts)
);
}
$ts = strtotime($data[ 'http://purl.org/dc/elements/1.1/date' ][0]);
$items[] = array(
'subject_uri' => $subject,
'title' => $data[ 'http://purl.org/rss/1.0/title' ][0],
'link' => $data[ 'http://purl.org/rss/1.0/link' ][0],
'date_iso' => $data[ 'http://purl.org/dc/elements/1.1/date' ][0],
'date_unix' => $ts,
'date_human' => human_timestamp($ts)
);
}
}
$smarty->assign("id", $user->id);
$smarty->assign("acctid", $user->acctid);
$smarty->assign('user', $user->name);
$smarty->assign('email', $user->email);
$smarty->assign('fullname', $user->fullname);
$smarty->assign('bio', $user->bio);
$smarty->assign('homepage', $user->homepage);
$smarty->assign('location', $user->location);
$smarty->assign('location_uri', $user->location_uri);
$smarty->assign('geo', Server::getLocationDetails($user->location_uri));
$smarty->assign('userlevel', $user->userlevel);
$smarty->assign('avatar', $user->getAvatar());
$aUserTagCloud = TagCloud::GenerateTagCloud('Scrobbles', 'artist', 40, $user->name);
if (!PEAR::isError ($aUserTagCloud)) {
$smarty->assign('user_tagcloud',$aUserTagCloud);
}
$smarty->assign('isme', ($_SESSION['user']->name == $user->name));
$smarty->assign('profile', true);
$smarty->assign('items', $items);
$smarty->assign('extra_head_links', array(
array(
'rel'=>'alternate',
'type' => 'application/rss+xml' ,
'title' => 'RSS 1.0 Feed (Journal)',
'href' => $rssFeed
)
));
$smarty->display('user-journal.tpl');
} else {
$smarty->assign('error', 'No RSS Feed for this User');
$smarty->assign('details', 'Shall I call in a missing feeds report?');
$smarty->display('error.tpl');
$smarty->assign("id", $user->id);
$smarty->assign("acctid", $user->acctid);
$smarty->assign('user', $user->name);
$smarty->assign('email', $user->email);
$smarty->assign('fullname', $user->fullname);
$smarty->assign('bio', $user->bio);
$smarty->assign('homepage', $user->homepage);
$smarty->assign('laconica_profile', $user->laconica_profile);
$smarty->assign('has_identica', $user->has_identica);
$smarty->assign('location', $user->location);
$smarty->assign('location_uri', $user->location_uri);
$smarty->assign('geo', Server::getLocationDetails($user->location_uri));
$smarty->assign('userlevel', $user->userlevel);
$smarty->assign('avatar', $user->getAvatar());
$aUserTagCloud = TagCloud::GenerateTagCloud('Scrobbles', 'artist', 40, $user->name);
if (!PEAR::isError ($aUserTagCloud)) {
$smarty->assign('user_tagcloud',$aUserTagCloud);
}
$smarty->assign('isme', ($_SESSION['user']->name == $user->name));
$smarty->assign('profile', true);
$smarty->assign('items', $items);
$smarty->assign('extra_head_links', array(
array(
'rel'=>'alternate',
'type' => 'application/rss+xml' ,
'title' => 'RSS 1.0 Feed (Journal)',
'href' => $user->journal_rss
)
));
$smarty->display('user-journal.tpl');
......@@ -42,6 +42,8 @@ if(isset($user->name)) {
$smarty->assign('fullname', $user->fullname);
$smarty->assign('bio', $user->bio);
$smarty->assign('homepage', $user->homepage);
$smarty->assign('laconica_profile', $user->laconica_profile);
$smarty->assign('has_identica', $user->has_identica);
$smarty->assign('location', $user->location);
$smarty->assign('location_uri', $user->location_uri);
$smarty->assign('geo', Server::getLocationDetails($user->location_uri));
......
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