function show_notice($notice) {
global $config;
$profile = $notice->getProfile();
- if (common_logged_in()) {
- $user = common_current_user();
- $user_profile = $user->getProfile();
- } else {
- $user_profile = false;
- }
+ $user = common_current_user();
# XXX: RDFa
common_element_start('li', array('class' => 'notice_single',
}
common_element_end('p');
$noticeurl = common_local_url('shownotice', array('notice' => $notice->id));
+ # XXX: we need to figure this out better. Is this right?
+ if (strcmp($notice->uri, $noticeurl) != 0 && preg_match('/^http/', $notice->uri)) {
+ $noticeurl = $notice->uri;
+ }
common_element_start('p', 'time');
common_element('a', array('class' => 'permalink',
'href' => $noticeurl,
'class' => 'replybutton'));
common_raw('→');
common_element_end('a');
- common_element_end('p');
- if ($user_profile && $notice->profile_id == $user_profile->id) {
+ if ($user && $notice->profile_id == $user->id) {
$deleteurl = common_local_url('deletenotice', array('notice' => $notice->id));
- common_element('a', array('class' => 'deletenotice',
- 'href' => $deleteurl),
- _('delete'));
+ common_element_start('a', array('class' => 'deletenotice',
+ 'href' => $deleteurl,
+ 'title' => _('delete')));
+ common_raw('×');
+ common_element_end('a');
}
+ common_element_end('p');
common_element_end('li');
}
common_element('span', 'noticesource', $source_name);
break;
default:
- $ns = new Notice_source($source);
+ $ns = Notice_source::staticGet($source);
if ($ns) {
common_element('a', array('href' => $ns->url),
$ns->name);
+ } else {
+ common_element('span', 'noticesource', $source_name);
}
+ break;
}
return;
}